@daisu-ui/cli 0.0.0-stage → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE +21 -0
  3. package/README.md +333 -2
  4. package/THIRD_PARTY_NOTICES.md +28 -0
  5. package/data/0.1.0-beta.1.json +1 -0
  6. package/data/0.1.0-beta.2.json +1 -0
  7. package/data/0.1.0-beta.3.json +1 -0
  8. package/data/versions.json +13 -0
  9. package/dist/api.d.ts +12 -0
  10. package/dist/api.js +11 -0
  11. package/dist/api.js.map +1 -0
  12. package/dist/app.d.ts +2 -0
  13. package/dist/app.js +216 -0
  14. package/dist/app.js.map +1 -0
  15. package/dist/clients.d.ts +31 -0
  16. package/dist/clients.js +279 -0
  17. package/dist/clients.js.map +1 -0
  18. package/dist/data-validation.d.ts +27 -0
  19. package/dist/data-validation.js +149 -0
  20. package/dist/data-validation.js.map +1 -0
  21. package/dist/detection.d.ts +22 -0
  22. package/dist/detection.js +109 -0
  23. package/dist/detection.js.map +1 -0
  24. package/dist/files.d.ts +12 -0
  25. package/dist/files.js +116 -0
  26. package/dist/files.js.map +1 -0
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +10 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/knowledge.d.ts +47 -0
  31. package/dist/knowledge.js +251 -0
  32. package/dist/knowledge.js.map +1 -0
  33. package/dist/mcp.d.ts +4 -0
  34. package/dist/mcp.js +218 -0
  35. package/dist/mcp.js.map +1 -0
  36. package/dist/onboarding.d.ts +113 -0
  37. package/dist/onboarding.js +491 -0
  38. package/dist/onboarding.js.map +1 -0
  39. package/dist/output.d.ts +2 -0
  40. package/dist/output.js +55 -0
  41. package/dist/output.js.map +1 -0
  42. package/dist/probe.d.ts +23 -0
  43. package/dist/probe.js +72 -0
  44. package/dist/probe.js.map +1 -0
  45. package/dist/registration.d.ts +13 -0
  46. package/dist/registration.js +253 -0
  47. package/dist/registration.js.map +1 -0
  48. package/dist/scanner.d.ts +50 -0
  49. package/dist/scanner.js +367 -0
  50. package/dist/scanner.js.map +1 -0
  51. package/dist/site-docs.d.ts +11 -0
  52. package/dist/site-docs.js +606 -0
  53. package/dist/site-docs.js.map +1 -0
  54. package/dist/types.d.ts +108 -0
  55. package/dist/types.js +2 -0
  56. package/dist/types.js.map +1 -0
  57. package/dist/updates.d.ts +32 -0
  58. package/dist/updates.js +84 -0
  59. package/dist/updates.js.map +1 -0
  60. package/package.json +77 -4
  61. package/skills/daisu-ui/SKILL.md +28 -0
@@ -0,0 +1 @@
1
+ {"schemaVersion":1,"library":"daisu-ui","version":"0.1.0-beta.1","generatedAt":"2026-11-25T07:18:20.648Z","source":{"commit":"ac479d4317c84fb0e3d8a260d4b9684525c5b77a","dirty":false,"digest":"305c0d922b02de8759f785c91b05ae6e6388dab256c5d16e2ef3e2ab876fb09e"},"peerDependencies":{"@lynx-js/react":"^0.126.2","@lynx-js/types":"^4.2.1","@types/react":"^18.3.0"},"publicExports":{"daisu-ui":["ActionSheet","ActionSheetAction","ActionSheetPanel","ActionSheetProps","ActionSheetSelection","AnchorIndex","Avatar","AvatarGroup","AvatarGroupItem","AvatarGroupProps","AvatarProps","AvatarSize","Backtop","BacktopProps","BacktopRequest","Badge","BadgeProps","BarCode","BarCodeFormat","BarCodeProps","BarCodeRef","BubbleOffset","BubblePlacement","Button","ButtonProps","ButtonSize","ButtonTone","ButtonVariant","Calendar","CalendarDayItem","CalendarDayType","CalendarProps","CalendarRef","CalendarShortcut","CalendarSwitchMode","CalendarType","CalendarValue","CalendarView","CalendarViewProps","CalendarViewRef","CarKeyboardLang","Card","CardProps","Cascader","CascaderLazyLoad","CascaderOption","CascaderProps","CascaderRef","CascaderSelection","CascaderValue","Cell","CellGroup","CellGroupProps","CellProps","Checkbox","CheckboxGroup","CheckboxGroupProps","CheckboxGroupRef","CheckboxProps","CheckboxRef","ChoiceType","ChoiceValue","Circle","CircleColor","CircleProps","Col","ColProps","Collapse","CollapseItem","CollapseItemData","CollapseProps","CollapseViewMore","ConfigButtonDefaults","ConfigProvider","ConfigProviderProps","ConfigProviderTheme","ConfigProviderThemeVars","ConfigProviderValue","ConfigTagDefaults","CountDown","CountDownProps","CountDownRef","CountTo","CountToProps","CountToRef","Curtain","CurtainClosePosition","CurtainProps","DatetimeColumn","DatetimeColumnType","DatetimeFilterParams","DatetimePicker","DatetimePickerChange","DatetimePickerModelValue","DatetimePickerProps","DatetimePickerRef","DatetimePickerType","DatetimePickerValue","DatetimePickerView","DatetimePickerViewProps","DatetimePickerViewRef","Dialog","DialogAction","DialogInputProps","DialogOptions","DialogProps","DialogResult","Divider","DividerAlign","DividerProps","DropMenu","DropMenuItem","DropMenuItemProps","DropMenuItemRef","DropMenuOption","DropMenuProps","DropMenuValue","Empty","EmptyProps","EmptyState","Fab","FabDirection","FabGap","FabPosition","FabProps","FabRef","FloatingPanel","FloatingPanelProps","Form","FormError","FormFieldRow","FormInputRow","FormItem","FormItemProps","FormModel","FormNumberRow","FormProps","FormRadioRow","FormRef","FormSchema","FormSchemaIssue","FormSelectRow","FormTextareaRow","FormValidateResult","FormValidateTrigger","Gap","GapProps","Grid","GridItem","GridItemProps","GridNavigation","GridProps","Icon","IconName","IconProps","ImagePreview","ImagePreviewOptions","ImagePreviewProps","ImagePreviewRef","ImagePreviewSlot","Img","ImgCropper","ImgCropperProps","ImgCropperRef","ImgCropperResult","ImgMode","ImgPreview","ImgProps","IndexAnchor","IndexAnchorProps","IndexBar","IndexBarProps","IndexBarRenderItem","IndexBarSection","Input","InputNumber","InputNumberProps","InputNumberTheme","InputNumberValue","InputProps","InputRef","Keyboard","KeyboardMode","KeyboardProps","LayerLifecycle","LegacyTabsProps","Loading","LoadingProps","LoadingSize","LoadingType","Loadmore","LoadmoreProps","LoadmoreState","Navbar","NavbarCapsule","NavbarCapsuleProps","NavbarProps","NoticeBar","NoticeBarClick","NoticeBarProps","NoticeBarRef","Notify","NotifyOptions","NotifyPosition","NotifyProps","NotifyType","NotifyVariant","NumberStepper","Overlay","OverlayProps","PagedList","Pagination","PaginationProps","PaginationRenderState","PasswordInput","PasswordInputProps","PercentPosition","Picker","PickerChange","PickerColumnItem","PickerColumns","PickerFieldNames","PickerOption","PickerProps","PickerRef","PickerValue","PickerView","PickerViewProps","PickerViewRef","Popover","PopoverMenuItem","PopoverProps","PopoverRef","Popup","PopupCloseReason","PopupPosition","PopupProps","PreviewVideo","Progress","ProgressColor","ProgressColorStop","ProgressProps","QrCode","QrCodeProps","QrCodeRef","Radio","RadioGroup","RadioGroupProps","RadioOption","RadioProps","Rate","RateProps","Resize","ResizeProps","ResizeRect","RichText","RichTextError","RichTextHeading","RichTextMediaEvent","RichTextMediaTimeUpdate","RichTextProps","RichTextRect","RichTextRef","RootPortal","RootPortalHost","RootPortalHostProps","RootPortalProps","Row","RowProps","Search","SearchProps","SearchRef","SectionTitle","Segmented","SegmentedInput","SegmentedOption","SegmentedProps","SegmentedValue","SelectPicker","SelectPickerOption","SelectPickerProps","SelectPickerRef","SelectPickerValue","Sidebar","SidebarBadgeProps","SidebarBeforeChange","SidebarItem","SidebarProps","SidebarValue","Signature","SignatureFooter","SignaturePoint","SignatureProps","SignatureRef","SignatureResult","SignatureStroke","Skeleton","SkeletonCell","SkeletonProps","SkeletonRow","SkeletonTheme","SlideVerify","SlideVerifyProps","SlideVerifyRef","Slider","SliderProps","SliderValue","SortButton","SortButtonProps","SortButtonValue","StandardTabsProps","Step","StepProps","StepStatus","Steps","StepsProps","Sticky","StickyBox","StickyBoxProps","StickyProps","SwipeAction","SwipeActionBeforeClose","SwipeActionClickEvent","SwipeActionPosition","SwipeActionProps","SwipeActionReason","SwipeActionRef","SwipeActionStatus","Swiper","SwiperChangeSource","SwiperIndicator","SwiperItem","SwiperNav","SwiperNavProps","SwiperProps","SwiperRef","Switch","SwitchProps","SwitchValue","SyncedInput","SyncedTextarea","TabOption","Tabbar","TabbarBeforeChange","TabbarItem","TabbarProps","TabbarValue","Table","TableColumn","TableProps","TableSortEvent","TableSpan","TableSpanScope","Tabs","TabsEvent","TabsItem","TabsLineTheme","TabsProps","TabsRef","TabsValue","Tag","TagProps","TagSize","TagTone","TagType","TagVariant","Text","TextFieldEvent","TextMode","TextProps","Textarea","TextareaProps","TextareaRef","TimeData","Toast","ToastDirection","ToastIconType","ToastLoadingType","ToastOptions","ToastPosition","ToastProps","Tooltip","TooltipProps","TooltipRef","Tour","TourEndEvent","TourProps","TourRef","TourRenderState","TourStep","TourStepEvent","Transition","TransitionName","TransitionProps","UiTokens","Upload","UploadAdapter","UploadFile","UploadProps","UseCountDownOptions","VideoPreview","VideoPreviewOptions","VideoPreviewProps","VideoPreviewRef","Watermark","WatermarkProps","iconNames","uiTokens","useConfigProvider","useCountDown","useDialog","useImagePreview","useNotify","useToast","useVideoPreview","zodAdapter"],"daisu-ui/router/runtime":[],"daisu-ui/router/location":["NavigationAction","RouteQuery","RouterHistoryState","parseRoutePath","parseRouterHistoryState","routePath"],"daisu-ui/utils":["calendarValues","calendarWeekNumber","datetimeLabel","datetimePad","swiperIndex","usePressState"],"daisu-ui/router":["Navigation","NavigationAction","NavigationGuard","NavigationResult","RouteQuery","RouteScreen","Router","RouterEntry","RouterHistoryAdapter","RouterHistoryState","RouterOptions","RouterProvider","RouterSnapshot","RouterView","RouterViewController","RouterViewProps","SceneNavigateOptions","connectRouterHistory","createRouter","parseRoutePath","parseRouterHistoryState","routePath","shouldFinishBack","useRoute","useRouteMatch","useRouter","useRouterSnapshot"],"daisu-ui/web":["registerDaisuWebComponents","registerImgCropper","registerQrCodeExport","registerRichTextMedia"]},"components":[{"name":"ActionSheet","id":"action-sheet","label":"ActionSheet 动作面板","category":"反馈","categoryId":"feedback","kind":"component","description":"动作面板从底部展示操作选项,支持列表、宫格面板、取消和自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/ActionSheet.tsx","docPath":"docs/ui/components/action-sheet.md","doc":"# ActionSheet 动作面板\n\n动作面板从底部展示操作选项,支持列表、宫格面板、取消和自定义内容。\n\n```tsx\nimport { ActionSheet } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 操作列表\n\n通过 `actions` 设置操作项,`show` 控制面板显示,`onSelect` 获取选中的操作。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"更多操作\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ActionSheet\n show={show}\n onChange={setShow}\n title=\"请选择操作\"\n actions={[{ name: '收藏' }, { name: '分享' }]}\n cancelText=\"取消\"\n onSelect={(selection) => {\n 'background only';\n console.log(selection);\n }}\n/>\n```\n\n## 组件样式\n\n### 面板标题\n\n通过 `title` 设置标题,通过 `cancelText` 设置取消按钮文案。\n\n```tsx\n<ActionSheet\n show={false}\n title=\"更多操作\"\n cancelText=\"取消\"\n actions={[{ name: '查看详情' }]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| zIndex | 对应 Popup 参数 | `number` | — |\n| show | 受控显示 | `boolean` | `false` |\n| duration | 对应 Popup 参数 | `number \\| boolean` | `200` |\n| rootPortal | 原生 Portal,需要 RootPortalHost | `boolean` | — |\n| closeOnClickModal | 选择 / 点击遮罩后请求关闭 | `boolean` | — |\n| lazyRender | 对应 Popup 参数 | `boolean` | — |\n| safeAreaInsetBottom | 宿主安全区数值,px | `boolean` | `true` |\n| safeAreaBottom | 宿主安全区数值,px | `number` | — |\n| actions | {name?,description?,color?,disabled?,loading?}[] | `readonly ActionSheetAction[]` | `[]` |\n| panels | 一维 Panel[] / 二维 Panel[][];有 panels 时优先显示 | `readonly ActionSheetPanel[] \\| readonly (readonly ActionSheetPanel[])[]` | `[]` |\n| title | 标题 / 取消按钮文案 | `string` | — |\n| cancelText | 标题 / 取消按钮文案 | `string` | — |\n| closeOnClickAction | 选择 / 点击遮罩后请求关闭 | `boolean` | `true` |\n| children | 自定义内容优先于 actions/panels | `ReactNode` | — |\n| titleClassName | 自定义样式 | `string` | `''` |\n| className | 自定义样式 | `string` | `''` |\n| style | 自定义样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 受控显示 | (show: boolean) => void |\n| onEnter | 动画生命周期 | () => void |\n| onAfterEnter | 动画生命周期 | () => void |\n| onLeave | 动画生命周期 | () => void |\n| onAfterLeave | 动画生命周期 | () => void |\n| onClickModal | 取消 / 请求关闭 / 点击遮罩 | () => void |\n| onClose | 取消 / 请求关闭 / 点击遮罩 | () => void |\n| onCancel | 取消 / 请求关闭 / 点击遮罩 | () => void |\n| onSelect | actions/单行面板:{item,index};多行:{item,rowIndex,colIndex} | (selection: ActionSheetSelection) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容优先于 actions/panels | ReactNode |\n| renderClose | 自定义区域内容 | (close: () => void) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ActionSheetAction = {\n name?: string;\n description?: string;\n color?: string;\n disabled?: boolean;\n loading?: boolean;\n};\n\nexport type ActionSheetPanel = {\n icon?: IconName | ReactNode;\n image?: string;\n title: string;\n color?: string;\n disabled?: boolean;\n};\n\nexport type ActionSheetSelection =\n | { item: ActionSheetAction; index: number }\n | { item: ActionSheetPanel; index: number }\n | { item: ActionSheetPanel; rowIndex: number; colIndex: number };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[ActionSheet 组件源码](./sources/action-sheet/ActionSheet.tsx.txt) · [示例源码](./sources/action-sheet/demo.tsx.txt) · [文档源码](./sources/action-sheet/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { ActionSheet, Button } from 'daisu-ui';\nimport type { ActionSheetAction, ActionSheetPanel, ActionSheetSelection } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst actions: ActionSheetAction[] = [{ name: '选项1' }, { name: '选项2' }, { name: '选项3', description: '描述信息' }];\nconst panels: ActionSheetPanel[] = [{ icon: 'user', title: '微信好友' }, { icon: 'share-internal', title: '朋友圈' }, { icon: 'message', title: 'QQ 好友' }, { icon: 'star-fill', title: '收藏' }, { icon: 'share-internal', title: '更多分享' }, { icon: 'user-add', title: '邀请好友' }];\nconst multiple: ActionSheetPanel[][] = [[...panels.slice(0, 4), { icon: 'user-add', title: '邀请' }, { icon: 'share-external', title: '外部分享' }, { icon: 'qrcode', title: '生成二维码' }, { icon: 'save', title: '保存图片' }], [{ icon: 'file-image', title: '图片' }, { icon: 'download', title: '下载' }, { icon: 'copy', title: '复制链接' }]];\nconst statuses: ActionSheetAction[] = [{ name: '颜色', color: '#0083ff' }, { name: '禁用', disabled: true }, { loading: true }];\n\nexport function ActionSheetExample() {\n const [variant, setVariant] = useState(0);\n const [show, setShow] = useState(false);\n const [notice, setNotice] = useState('');\n const open = (index: number) => { 'background only'; setVariant(index); setShow(true); setNotice(''); };\n const selected = (event: ActionSheetSelection) => {\n 'background only';\n const name = 'name' in event.item ? event.item.name : 'title' in event.item ? event.item.title : '';\n setNotice('rowIndex' in event ? `当前选中项: ${name}, 行下标: ${event.rowIndex}, 列下标: ${event.colIndex}` : `当前选中项: ${name}, 下标: ${event.index}`);\n };\n const block = (title: string, index: number) => <ExampleBlock title={title}><view className=\"demo-layer-trigger\"><Button label=\"弹出菜单\" onTap={() => open(index)} /></view></ExampleBlock>;\n return <view>\n <DemoGroup title=\"组件类型\">{block('基本用法', 0)}{block('自定义面板单行', 1)}{block('自定义面板多行', 2)}</DemoGroup>\n <DemoGroup title=\"组件状态\">{block('选项状态', 3)}</DemoGroup>\n <DemoGroup title=\"组件变体\">{block('取消按钮', 4)}{block('标题', 5)}</DemoGroup>\n <ActionSheet show={show} onChange={setShow} rootPortal className=\"ui-demo-page\" actions={variant === 3 ? statuses : actions} panels={variant === 1 ? panels : variant === 2 ? multiple : []} cancelText={[1, 2, 4].includes(variant) ? '取消' : undefined} title={variant === 5 ? '标题' : undefined} onSelect={selected}>\n {variant === 5 ? <view className=\"demo-action-sheet-custom\"><text>内容</text></view> : undefined}\n </ActionSheet>\n {notice ? <view className=\"demo-action-sheet-notice\" bindtap={() => setNotice('')}><text>{notice}</text></view> : null}\n </view>;\n}\n","props":[{"name":"zIndex","type":"number","optional":true,"description":"对应 Popup 参数"},{"name":"duration","type":"number | boolean","optional":true,"description":"对应 Popup 参数","defaultValue":"200"},{"name":"show","type":"boolean","optional":true,"description":"受控显示","defaultValue":"false","values":[false,true]},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"选择 / 点击遮罩后请求关闭","values":[false,true]},{"name":"lazyRender","type":"boolean","optional":true,"description":"对应 Popup 参数","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"宿主安全区数值,px","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"宿主安全区数值,px"},{"name":"rootPortal","type":"boolean","optional":true,"description":"原生 Portal,需要 RootPortalHost","values":[false,true]},{"name":"actions","type":"readonly ActionSheetAction[]","optional":true,"description":"{name?,description?,color?,disabled?,loading?}[]","defaultValue":"[]"},{"name":"panels","type":"readonly ActionSheetPanel[] | readonly (readonly ActionSheetPanel[])[]","optional":true,"description":"一维 Panel[] / 二维 Panel[][];有 panels 时优先显示","defaultValue":"[]"},{"name":"title","type":"string","optional":true,"description":"标题 / 取消按钮文案"},{"name":"cancelText","type":"string","optional":true,"description":"标题 / 取消按钮文案"},{"name":"closeOnClickAction","type":"boolean","optional":true,"description":"选择 / 点击遮罩后请求关闭","defaultValue":"true","values":[false,true]},{"name":"titleClassName","type":"string","optional":true,"description":"自定义样式","defaultValue":"''"},{"name":"className","type":"string","optional":true,"description":"自定义样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"自定义样式"}],"events":[{"name":"onEnter","type":"() => void","optional":true,"description":"动画生命周期"},{"name":"onAfterEnter","type":"() => void","optional":true,"description":"动画生命周期"},{"name":"onLeave","type":"() => void","optional":true,"description":"动画生命周期"},{"name":"onAfterLeave","type":"() => void","optional":true,"description":"动画生命周期"},{"name":"onChange","type":"(show: boolean) => void","optional":true,"description":"受控显示"},{"name":"onClickModal","type":"() => void","optional":true,"description":"取消 / 请求关闭 / 点击遮罩"},{"name":"onClose","type":"() => void","optional":true,"description":"取消 / 请求关闭 / 点击遮罩"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消 / 请求关闭 / 点击遮罩"},{"name":"onSelect","type":"(selection: ActionSheetSelection) => void","optional":true,"description":"actions/单行面板:{item,index};多行:{item,rowIndex,colIndex}"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容优先于 actions/panels"},{"name":"renderClose","type":"(close: () => void) => ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","操作列表"],"title":"操作列表","section":"组件类型","description":"通过 `actions` 设置操作项,`show` 控制面板显示,`onSelect` 获取选中的操作。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"更多操作\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ActionSheet\n show={show}\n onChange={setShow}\n title=\"请选择操作\"\n actions={[{ name: '收藏' }, { name: '分享' }]}\n cancelText=\"取消\"\n onSelect={(selection) => {\n 'background only';\n console.log(selection);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"更多操作\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ActionSheet\n show={show}\n onChange={setShow}\n title=\"请选择操作\"\n actions={[{ name: '收藏' }, { name: '分享' }]}\n cancelText=\"取消\"\n onSelect={(selection) => {\n 'background only';\n console.log(selection);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","面板标题"],"title":"面板标题","section":"组件样式","description":"通过 `title` 设置标题,通过 `cancelText` 设置取消按钮文案。","language":"tsx","code":"<ActionSheet\n show={false}\n title=\"更多操作\"\n cancelText=\"取消\"\n actions={[{ name: '查看详情' }]}\n/>\n","blocks":[{"language":"tsx","code":"<ActionSheet\n show={false}\n title=\"更多操作\"\n cancelText=\"取消\"\n actions={[{ name: '查看详情' }]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Avatar","id":"avatar","label":"Avatar 头像","category":"数据展示","categoryId":"display","kind":"component","description":"头像用于展示用户或对象的图片、文字和图标,头像组可组合多个头像并折叠超出部分。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Avatar.tsx","docPath":"docs/ui/components/avatar.md","doc":"# Avatar 头像\n\n头像用于展示用户或对象的图片、文字和图标,头像组可组合多个头像并折叠超出部分。\n\n```tsx\nimport { Avatar, AvatarGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 图片、文字和图标\n\n通过 `src`、`text` 或 `icon` 设置头像内容,`alt` 用于图片说明及失败替代文字。\n\n```tsx\n<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n```\n\n## 组件样式\n\n### 尺寸与形状\n\n通过 `size` 设置头像尺寸,通过 `shape` 设置形状,`bgColor` 设置背景色。\n\n```tsx\n<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n```\n\n## 组合用法\n\n### 头像组\n\n通过 `AvatarGroup.items` 配置头像组,`maxCount` 限制展示数量,超出部分折叠显示。\n\n```tsx\n<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n```\n\n## Attributes 属性\n\n### Avatar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| src | 优先级children、src、text、icon | `string` | `''` |\n| text | 优先级children、src、text、icon | `string` | `''` |\n| icon | 优先级children、src、text、icon | `string` | `''` |\n| size | 统一组内尺寸与形状,优先于各项对应参数 | `AvatarSize` | `'normal'` |\n| shape | 统一组内尺寸与形状,优先于各项对应参数 | `'round' \\| 'square'` | `'round'` |\n| bgColor | 背景与文字/内置图标色;传背景且未传文字色时默认白字 | `string` | — |\n| color | 背景与文字/内置图标色;传背景且未传文字色时默认白字 | `string` | — |\n| alt | 图片失败时优先显示此文本,再使用text或icon;也是无障碍标签 | `string` | `''` |\n| mode | 原生image支持的填充模式 | `'scaleToFill' \\| 'aspectFit' \\| 'aspectFill' \\| 'center'` | `'aspectFill'` |\n| children | 自定义内容,优先于图片等参数 | `ReactNode` | — |\n| className | 分组根样式 | `string` | `''` |\n| style | 分组根样式 | `CSSProperties` | — |\n\n### AvatarGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | AvatarProps加可选key,保持输入顺序;可能重排的数据应传稳定key | `readonly AvatarGroupItem[]` | 必填 |\n| maxCount | 显示前N个头像,另追加+剩余数;正数向下取整,0、负值和非有限数显示全部 | `number` | — |\n| cascading | 按官网实际行为:left-up的zIndex随顺序增加,right-up随顺序减小;不反转数据 | `'left-up' \\| 'right-up'` | `'left-up'` |\n| size | 统一组内尺寸与形状,优先于各项对应参数 | `AvatarSize` | `'normal'` |\n| shape | 统一组内尺寸与形状,优先于各项对应参数 | `'round' \\| 'square'` | `'round'` |\n| collapseAvatar | 自定义折叠文字,空值使用+剩余数 | `string` | — |\n| vertical | 纵向堆叠;否则横向 | `boolean` | `false` |\n| className | 分组根样式 | `string` | `''` |\n| style | 分组根样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Avatar.onTap | 点击回调,不直接发起业务请求或导航 | () => void |\n| Avatar.onError | 图片加载失败回调,detail包含平台错误信息 | (event: BaseEvent<'error', ImageErrorEvent>) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Avatar.children | 自定义内容,优先于图片等参数 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type AvatarSize =\n | 'large'\n | 'medium'\n | 'normal'\n | 'small'\n | (string & {})\n | number;\n\nexport type AvatarGroupItem = AvatarProps & { key?: string | number };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-avatar-bg` | 当前组件 |\n| `--cso-ui-avatar-collapse-bg` | 当前组件 |\n| `--cso-ui-avatar-collapse-color` | 当前组件 |\n| `--cso-ui-avatar-text` | 当前组件 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Avatar 组件源码](./sources/avatar/Avatar.tsx.txt) · [AvatarGroup 组件源码](./sources/avatar/Avatar.tsx.txt) · [示例源码](./sources/avatar/demo.tsx.txt) · [文档源码](./sources/avatar/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Avatar, AvatarGroup, Badge, Icon, RootPortal } from 'daisu-ui';\nimport type { AvatarGroupItem } from 'daisu-ui';\nimport panda from '../../../assets/demo-panda.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst group: readonly AvatarGroupItem[] = [{ key: 'panda', src: panda }, { key: 'star', icon: 'star-fill' }, { key: 'a', text: 'A', bgColor: '#1c64fd' }, { key: 'b', text: 'B', bgColor: '#12b886' }, { key: 'c', text: 'C', bgColor: '#f14646' }];\n\nexport function AvatarExample() {\n const [notice, setNotice] = useState(false);\n useEffect(() => { if (!notice) return; const timer = setTimeout(() => { 'background only'; setNotice(false); }, 2000); return () => clearTimeout(timer); }, [notice]);\n const clicked = () => { 'background only'; setNotice(true); };\n return <view className=\"demo-avatar-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\"><view className=\"demo-avatar-row\"><Avatar src={panda} /><Avatar text=\"U\" /><Avatar icon=\"user\" /></view></ExampleBlock>\n <ExampleBlock title=\"头像组基础用法\"><view className=\"demo-avatar-group-line\"><AvatarGroup items={group.slice(0, 4)} /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"可点击\"><view className=\"demo-avatar-row\"><Avatar src={panda} size=\"large\" onTap={clicked} /><Avatar text=\"点我\" size=\"large\" bgColor=\"#1c64fd\" onTap={clicked} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"头像形状\"><view className=\"demo-avatar-row\"><Avatar src={panda} shape=\"square\" /><Avatar src={panda} /></view></ExampleBlock>\n <ExampleBlock title=\"头像尺寸\"><view className=\"demo-avatar-row\">{(['large', 'medium', 'normal', 'small', 80, 60, '40px'] as const).map(size => <Avatar key={String(size)} src={panda} size={size} />)}</view></ExampleBlock>\n <ExampleBlock title=\"自定义颜色\"><view className=\"demo-avatar-row\"><Avatar text=\"W\" bgColor=\"#f14646\" /><Avatar text=\"O\" bgColor=\"#12b886\" /><Avatar text=\"T\" bgColor=\"#1c64fd\" /><Avatar icon=\"user\" bgColor=\"var(--cso-ui-canvas)\" color=\"#868a9c\" /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"带徽记的头像\"><view className=\"demo-avatar-row\"><Badge value={10} type=\"primary\"><Avatar src={panda} shape=\"square\" /></Badge><Badge value={20}><Avatar src={panda} shape=\"square\" /></Badge><Badge isDot><Avatar src={panda} shape=\"square\" /></Badge><Badge isDot><Avatar text=\"A\" shape=\"square\" bgColor=\"#1c64fd\" /></Badge></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"自定义内容\"><view className=\"demo-avatar-row\"><Avatar><text className=\"demo-avatar-vip\">VIP</text></Avatar><Avatar><Icon name=\"star-fill\" size={24} color=\"#f0883a\" /></Avatar></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"头像组最大数量\"><view className=\"demo-avatar-group-line\"><AvatarGroup items={group} maxCount={3} /></view></ExampleBlock>\n <ExampleBlock title=\"头像组叠层方向\"><view className=\"demo-avatar-column\"><AvatarGroup items={group} maxCount={4} /><AvatarGroup items={group} maxCount={4} cascading=\"right-up\" /></view></ExampleBlock>\n <ExampleBlock title=\"头像组垂直堆叠\"><view className=\"demo-avatar-row\"><AvatarGroup items={group} maxCount={4} vertical /><AvatarGroup items={group} maxCount={4} cascading=\"right-up\" vertical /></view></ExampleBlock>\n </DemoGroup>\n {notice ? <RootPortal><view className=\"demo-index-bar-message\"><text>点击头像</text></view></RootPortal> : null}\n </view>;\n}\n","props":[{"name":"src","type":"string","optional":true,"description":"优先级children、src、text、icon","defaultValue":"''"},{"name":"text","type":"string","optional":true,"description":"优先级children、src、text、icon","defaultValue":"''"},{"name":"icon","type":"string","optional":true,"description":"优先级children、src、text、icon","defaultValue":"''"},{"name":"size","type":"AvatarSize","optional":true,"description":"统一组内尺寸与形状,优先于各项对应参数","defaultValue":"'normal'"},{"name":"shape","type":"'round' | 'square'","optional":true,"description":"统一组内尺寸与形状,优先于各项对应参数","defaultValue":"'round'","values":["square","round"]},{"name":"bgColor","type":"string","optional":true,"description":"背景与文字/内置图标色;传背景且未传文字色时默认白字"},{"name":"color","type":"string","optional":true,"description":"背景与文字/内置图标色;传背景且未传文字色时默认白字"},{"name":"alt","type":"string","optional":true,"description":"图片失败时优先显示此文本,再使用text或icon;也是无障碍标签","defaultValue":"''"},{"name":"mode","type":"'scaleToFill' | 'aspectFit' | 'aspectFill' | 'center'","optional":true,"description":"原生image支持的填充模式","defaultValue":"'aspectFill'","values":["center","scaleToFill","aspectFit","aspectFill"]},{"name":"className","type":"string","optional":true,"description":"分组根样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"分组根样式"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":""},{"name":"onError","type":"(event: BaseEvent<'error', ImageErrorEvent>) => void","optional":true,"description":""}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容,优先于图片等参数"}],"methods":[],"cssVars":[{"name":"--cso-ui-avatar-bg","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-avatar-collapse-bg","defaultValue":"#ebedf0","description":""},{"name":"--cso-ui-avatar-collapse-color","defaultValue":"#969799","description":""},{"name":"--cso-ui-avatar-text","defaultValue":"var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted))","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","图片、文字和图标"],"title":"图片、文字和图标","section":"组件类型","description":"通过 `src`、`text` 或 `icon` 设置头像内容,`alt` 用于图片说明及失败替代文字。","language":"tsx","code":"<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n","blocks":[{"language":"tsx","code":"<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n"}]},{"name":"demo-2","aliases":["demo-2","尺寸与形状"],"title":"尺寸与形状","section":"组件样式","description":"通过 `size` 设置头像尺寸,通过 `shape` 设置形状,`bgColor` 设置背景色。","language":"tsx","code":"<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n","blocks":[{"language":"tsx","code":"<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n"}]},{"name":"demo-3","aliases":["demo-3","头像组"],"title":"头像组","section":"组合用法","description":"通过 `AvatarGroup.items` 配置头像组,`maxCount` 限制展示数量,超出部分折叠显示。","language":"tsx","code":"<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n","blocks":[{"language":"tsx","code":"<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n"}]}],"allowUnknownProps":false},{"name":"AvatarGroup","id":"avatar","label":"Avatar 头像","category":"数据展示","categoryId":"display","kind":"component","description":"头像用于展示用户或对象的图片、文字和图标,头像组可组合多个头像并折叠超出部分。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Avatar.tsx","docPath":"docs/ui/components/avatar.md","doc":"# Avatar 头像\n\n头像用于展示用户或对象的图片、文字和图标,头像组可组合多个头像并折叠超出部分。\n\n```tsx\nimport { Avatar, AvatarGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 图片、文字和图标\n\n通过 `src`、`text` 或 `icon` 设置头像内容,`alt` 用于图片说明及失败替代文字。\n\n```tsx\n<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n```\n\n## 组件样式\n\n### 尺寸与形状\n\n通过 `size` 设置头像尺寸,通过 `shape` 设置形状,`bgColor` 设置背景色。\n\n```tsx\n<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n```\n\n## 组合用法\n\n### 头像组\n\n通过 `AvatarGroup.items` 配置头像组,`maxCount` 限制展示数量,超出部分折叠显示。\n\n```tsx\n<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n```\n\n## Attributes 属性\n\n### Avatar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| src | 优先级children、src、text、icon | `string` | `''` |\n| text | 优先级children、src、text、icon | `string` | `''` |\n| icon | 优先级children、src、text、icon | `string` | `''` |\n| size | 统一组内尺寸与形状,优先于各项对应参数 | `AvatarSize` | `'normal'` |\n| shape | 统一组内尺寸与形状,优先于各项对应参数 | `'round' \\| 'square'` | `'round'` |\n| bgColor | 背景与文字/内置图标色;传背景且未传文字色时默认白字 | `string` | — |\n| color | 背景与文字/内置图标色;传背景且未传文字色时默认白字 | `string` | — |\n| alt | 图片失败时优先显示此文本,再使用text或icon;也是无障碍标签 | `string` | `''` |\n| mode | 原生image支持的填充模式 | `'scaleToFill' \\| 'aspectFit' \\| 'aspectFill' \\| 'center'` | `'aspectFill'` |\n| children | 自定义内容,优先于图片等参数 | `ReactNode` | — |\n| className | 分组根样式 | `string` | `''` |\n| style | 分组根样式 | `CSSProperties` | — |\n\n### AvatarGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | AvatarProps加可选key,保持输入顺序;可能重排的数据应传稳定key | `readonly AvatarGroupItem[]` | 必填 |\n| maxCount | 显示前N个头像,另追加+剩余数;正数向下取整,0、负值和非有限数显示全部 | `number` | — |\n| cascading | 按官网实际行为:left-up的zIndex随顺序增加,right-up随顺序减小;不反转数据 | `'left-up' \\| 'right-up'` | `'left-up'` |\n| size | 统一组内尺寸与形状,优先于各项对应参数 | `AvatarSize` | `'normal'` |\n| shape | 统一组内尺寸与形状,优先于各项对应参数 | `'round' \\| 'square'` | `'round'` |\n| collapseAvatar | 自定义折叠文字,空值使用+剩余数 | `string` | — |\n| vertical | 纵向堆叠;否则横向 | `boolean` | `false` |\n| className | 分组根样式 | `string` | `''` |\n| style | 分组根样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Avatar.onTap | 点击回调,不直接发起业务请求或导航 | () => void |\n| Avatar.onError | 图片加载失败回调,detail包含平台错误信息 | (event: BaseEvent<'error', ImageErrorEvent>) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Avatar.children | 自定义内容,优先于图片等参数 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type AvatarSize =\n | 'large'\n | 'medium'\n | 'normal'\n | 'small'\n | (string & {})\n | number;\n\nexport type AvatarGroupItem = AvatarProps & { key?: string | number };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-avatar-bg` | 当前组件 |\n| `--cso-ui-avatar-collapse-bg` | 当前组件 |\n| `--cso-ui-avatar-collapse-color` | 当前组件 |\n| `--cso-ui-avatar-text` | 当前组件 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Avatar 组件源码](./sources/avatar/Avatar.tsx.txt) · [AvatarGroup 组件源码](./sources/avatar/Avatar.tsx.txt) · [示例源码](./sources/avatar/demo.tsx.txt) · [文档源码](./sources/avatar/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Avatar, AvatarGroup, Badge, Icon, RootPortal } from 'daisu-ui';\nimport type { AvatarGroupItem } from 'daisu-ui';\nimport panda from '../../../assets/demo-panda.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst group: readonly AvatarGroupItem[] = [{ key: 'panda', src: panda }, { key: 'star', icon: 'star-fill' }, { key: 'a', text: 'A', bgColor: '#1c64fd' }, { key: 'b', text: 'B', bgColor: '#12b886' }, { key: 'c', text: 'C', bgColor: '#f14646' }];\n\nexport function AvatarExample() {\n const [notice, setNotice] = useState(false);\n useEffect(() => { if (!notice) return; const timer = setTimeout(() => { 'background only'; setNotice(false); }, 2000); return () => clearTimeout(timer); }, [notice]);\n const clicked = () => { 'background only'; setNotice(true); };\n return <view className=\"demo-avatar-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\"><view className=\"demo-avatar-row\"><Avatar src={panda} /><Avatar text=\"U\" /><Avatar icon=\"user\" /></view></ExampleBlock>\n <ExampleBlock title=\"头像组基础用法\"><view className=\"demo-avatar-group-line\"><AvatarGroup items={group.slice(0, 4)} /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"可点击\"><view className=\"demo-avatar-row\"><Avatar src={panda} size=\"large\" onTap={clicked} /><Avatar text=\"点我\" size=\"large\" bgColor=\"#1c64fd\" onTap={clicked} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"头像形状\"><view className=\"demo-avatar-row\"><Avatar src={panda} shape=\"square\" /><Avatar src={panda} /></view></ExampleBlock>\n <ExampleBlock title=\"头像尺寸\"><view className=\"demo-avatar-row\">{(['large', 'medium', 'normal', 'small', 80, 60, '40px'] as const).map(size => <Avatar key={String(size)} src={panda} size={size} />)}</view></ExampleBlock>\n <ExampleBlock title=\"自定义颜色\"><view className=\"demo-avatar-row\"><Avatar text=\"W\" bgColor=\"#f14646\" /><Avatar text=\"O\" bgColor=\"#12b886\" /><Avatar text=\"T\" bgColor=\"#1c64fd\" /><Avatar icon=\"user\" bgColor=\"var(--cso-ui-canvas)\" color=\"#868a9c\" /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"带徽记的头像\"><view className=\"demo-avatar-row\"><Badge value={10} type=\"primary\"><Avatar src={panda} shape=\"square\" /></Badge><Badge value={20}><Avatar src={panda} shape=\"square\" /></Badge><Badge isDot><Avatar src={panda} shape=\"square\" /></Badge><Badge isDot><Avatar text=\"A\" shape=\"square\" bgColor=\"#1c64fd\" /></Badge></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"自定义内容\"><view className=\"demo-avatar-row\"><Avatar><text className=\"demo-avatar-vip\">VIP</text></Avatar><Avatar><Icon name=\"star-fill\" size={24} color=\"#f0883a\" /></Avatar></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"头像组最大数量\"><view className=\"demo-avatar-group-line\"><AvatarGroup items={group} maxCount={3} /></view></ExampleBlock>\n <ExampleBlock title=\"头像组叠层方向\"><view className=\"demo-avatar-column\"><AvatarGroup items={group} maxCount={4} /><AvatarGroup items={group} maxCount={4} cascading=\"right-up\" /></view></ExampleBlock>\n <ExampleBlock title=\"头像组垂直堆叠\"><view className=\"demo-avatar-row\"><AvatarGroup items={group} maxCount={4} vertical /><AvatarGroup items={group} maxCount={4} cascading=\"right-up\" vertical /></view></ExampleBlock>\n </DemoGroup>\n {notice ? <RootPortal><view className=\"demo-index-bar-message\"><text>点击头像</text></view></RootPortal> : null}\n </view>;\n}\n","props":[{"name":"items","type":"readonly AvatarGroupItem[]","optional":false,"description":"AvatarProps加可选key,保持输入顺序;可能重排的数据应传稳定key","defaultValue":"必填"},{"name":"maxCount","type":"number","optional":true,"description":"显示前N个头像,另追加+剩余数;正数向下取整,0、负值和非有限数显示全部"},{"name":"cascading","type":"'left-up' | 'right-up'","optional":true,"description":"按官网实际行为:left-up的zIndex随顺序增加,right-up随顺序减小;不反转数据","defaultValue":"'left-up'","values":["left-up","right-up"]},{"name":"size","type":"AvatarSize","optional":true,"description":"统一组内尺寸与形状,优先于各项对应参数","defaultValue":"'normal'"},{"name":"shape","type":"'round' | 'square'","optional":true,"description":"统一组内尺寸与形状,优先于各项对应参数","defaultValue":"'round'","values":["square","round"]},{"name":"collapseAvatar","type":"string","optional":true,"description":"自定义折叠文字,空值使用+剩余数"},{"name":"vertical","type":"boolean","optional":true,"description":"纵向堆叠;否则横向","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"分组根样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"分组根样式"}],"events":[],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-avatar-bg","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-avatar-collapse-bg","defaultValue":"#ebedf0","description":""},{"name":"--cso-ui-avatar-collapse-color","defaultValue":"#969799","description":""},{"name":"--cso-ui-avatar-text","defaultValue":"var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted))","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","图片、文字和图标"],"title":"图片、文字和图标","section":"组件类型","description":"通过 `src`、`text` 或 `icon` 设置头像内容,`alt` 用于图片说明及失败替代文字。","language":"tsx","code":"<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n","blocks":[{"language":"tsx","code":"<Avatar src=\"https://example.com/avatar.jpg\" alt=\"用户头像\" />\n<Avatar text=\"张\" />\n<Avatar icon=\"user\" />\n"}]},{"name":"demo-2","aliases":["demo-2","尺寸与形状"],"title":"尺寸与形状","section":"组件样式","description":"通过 `size` 设置头像尺寸,通过 `shape` 设置形状,`bgColor` 设置背景色。","language":"tsx","code":"<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n","blocks":[{"language":"tsx","code":"<Avatar text=\"A\" size=\"large\" />\n<Avatar text=\"B\" shape=\"square\" bgColor=\"#1c64fd\" />\n"}]},{"name":"demo-3","aliases":["demo-3","头像组"],"title":"头像组","section":"组合用法","description":"通过 `AvatarGroup.items` 配置头像组,`maxCount` 限制展示数量,超出部分折叠显示。","language":"tsx","code":"<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n","blocks":[{"language":"tsx","code":"<AvatarGroup\n items={[\n { key: 'a', text: 'A' },\n { key: 'b', text: 'B' },\n { key: 'c', text: 'C' },\n ]}\n maxCount={2}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Backtop","id":"backtop","label":"Backtop 回到顶部","category":"导航","categoryId":"navigation","kind":"component","description":"回到顶部按钮根据滚动距离显示,点击后将滚动请求交给页面处理。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Backtop.tsx","docPath":"docs/ui/components/backtop.md","doc":"# Backtop 回到顶部\n\n回到顶部按钮根据滚动距离显示,点击后将滚动请求交给页面处理。\n\n```tsx\nimport { Backtop } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 与滚动容器组合\n\n将滚动距离传入 `scrollTop`,通过 `onBacktop` 处理回到顶部的滚动请求。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [scrollTop, setScrollTop] = useState(0);\n\nconst [target, setTarget] = useState(0);\n\n<scroll-view\n scroll-y\n style={{ height: '400px' }}\n scroll-top={target}\n bindscroll={(event) => {\n 'background only';\n setScrollTop(event.detail.scrollTop);\n }}\n>\n <view style={{ height: '1200px' }}>\n <text>滚动内容</text>\n </view>\n</scroll-view>\n<Backtop\n scrollTop={scrollTop}\n onBacktop={() => {\n 'background only';\n setTarget(target === 0 ? 0.01 : 0);\n }}\n/>\n```\n\n## 组件样式\n\n### 方形与文案\n\n设置 `shape=\"square\"` 使用方形按钮,通过 `text` 设置文字。\n\n```tsx\n<Backtop\n scrollTop={500}\n shape=\"square\"\n text=\"顶部\"\n onBacktop={(request) => {\n 'background only';\n console.log(request);\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| scrollTop | 外部 scroll-view/List 的滚动距离 | `number` | 必填 |\n| top | 严格大于此距离显示 | `number` | `300` |\n| duration | 传给滚动控制器的毫秒数,负值取0、无效数回退100 | `number` | `100` |\n| zIndex | 定位层级 | `number` | `10` |\n| bottom | 距视口底部、右侧的px距离 | `number` | `100` |\n| right | 距视口底部、右侧的px距离 | `number` | `20` |\n| shape | 48×48按钮,圆形或4px圆角方形 | `'circle' \\| 'square'` | `'circle'` |\n| text | 默认图标下的10px文字 | `string` | — |\n| iconStyle | 图标容器样式;color会传给原版SVG图标 | `CSSProperties` | — |\n| children | 完全替换默认图标与文字 | `ReactNode` | — |\n| className | 按钮样式 | `string` | `''` |\n| style | 按钮样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onBacktop | 请求所属滚动容器回到顶部;接收目标时长 | (request: BacktopRequest) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 完全替换默认图标与文字 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type BacktopRequest = { duration: number };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Backtop 组件源码](./sources/backtop/Backtop.tsx.txt) · [示例源码](./sources/backtop/demo.tsx.txt) · [文档源码](./sources/backtop/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { Backtop, Icon } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction Option({ label, checked, onChange, last = false }: { label: string; checked: boolean; onChange: () => void; last?: boolean }) {\n return <view className={`demo-backtop-option ${last ? 'demo-backtop-option-last' : ''}`} bindtap={onChange} accessibility-element accessibility-traits=\"button\" accessibility-label={`${label},${checked ? '已选中' : '未选中'}`}><Icon name={checked ? 'check-circle-fill' : 'uncheck-circle'} color={checked ? '#1c64fd' : '#e5e6eb'} size={22} /><text>{label}</text></view>;\n}\n\nexport function BacktopExample() {\n const scroll = useRef<NodesRef>(null);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const currentTop = useRef(0);\n const [scrollTop, setScrollTop] = useState(0);\n const [square, setSquare] = useState(false);\n const [text, setText] = useState(false);\n const [customIcon, setCustomIcon] = useState(false);\n const [distance, setDistance] = useState(false);\n const [customStyle, setCustomStyle] = useState(false);\n const [slow, setSlow] = useState(false);\n const cancel = () => { 'background only'; clearTimeout(timer.current); timer.current = undefined; };\n useEffect(() => cancel, []);\n const backtop = ({ duration }: { duration: number }) => {\n 'background only';\n cancel();\n const start = currentTop.current;\n const started = Date.now();\n const step = () => {\n 'background only';\n const progress = duration ? Math.min(1, (Date.now() - started) / duration) : 1;\n const offset = start * (1 - progress) ** 3;\n scroll.current?.invoke({ method: 'scrollTo', params: { offset, index: 0, smooth: false } }).exec();\n if (progress < 1) timer.current = setTimeout(step, 16);\n else timer.current = undefined;\n };\n step();\n };\n return <view className=\"demo-backtop-shell\">\n <scroll-view ref={scroll} className=\"ui-demo-component-scroll\" scroll-orientation=\"vertical\" bindtouchstart={cancel} bindscroll={event => { 'background only'; currentTop.current = event.detail.scrollTop; setScrollTop(event.detail.scrollTop); }}>\n <view className=\"demo-backtop-page\">\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"形状与文字\"><Option label=\"显示方形\" checked={square} onChange={() => { 'background only'; setSquare(!square); }} /><Option label=\"显示文字\" checked={text} onChange={() => { 'background only'; setText(!text); }} last /></ExampleBlock>\n <ExampleBlock title=\"自定义图标\"><Option label=\"自定义图标\" checked={customIcon} onChange={() => { 'background only'; setCustomIcon(!customIcon); }} last /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义距离\"><Option label=\"自定义距离\" checked={distance} onChange={() => { 'background only'; setDistance(!distance); }} last /></ExampleBlock>\n <ExampleBlock title=\"自定义样式\"><Option label=\"自定义样式\" checked={customStyle} onChange={() => { 'background only'; setCustomStyle(!customStyle); }} last /></ExampleBlock>\n <ExampleBlock title=\"自定义返回顶部滚动时间\"><Option label=\"自定义返回顶部滚动时间\" checked={slow} onChange={() => { 'background only'; setSlow(!slow); }} last /></ExampleBlock>\n </DemoGroup>\n <view className=\"demo-backtop-spacer\" />\n </view>\n </scroll-view>\n <Backtop scrollTop={scrollTop} onBacktop={backtop} shape={square ? 'square' : 'circle'} text={text ? '顶部' : undefined} top={distance ? 600 : 300} bottom={distance ? 50 : 100} right={distance ? 40 : 20} duration={slow ? 1000 : 100} style={customStyle ? { backgroundColor: '#1c64fd', color: '#fff' } : undefined} iconStyle={customStyle ? { color: '#fff' } : undefined}>{customIcon ? <text className=\"demo-backtop-custom-icon\">TOP</text> : undefined}</Backtop>\n </view>;\n}\n","props":[{"name":"scrollTop","type":"number","optional":false,"description":"外部 scroll-view/List 的滚动距离","defaultValue":"必填"},{"name":"top","type":"number","optional":true,"description":"严格大于此距离显示","defaultValue":"300"},{"name":"duration","type":"number","optional":true,"description":"传给滚动控制器的毫秒数,负值取0、无效数回退100","defaultValue":"100"},{"name":"zIndex","type":"number","optional":true,"description":"定位层级","defaultValue":"10"},{"name":"bottom","type":"number","optional":true,"description":"距视口底部、右侧的px距离","defaultValue":"100"},{"name":"right","type":"number","optional":true,"description":"距视口底部、右侧的px距离","defaultValue":"20"},{"name":"shape","type":"'circle' | 'square'","optional":true,"description":"48×48按钮,圆形或4px圆角方形","defaultValue":"'circle'","values":["circle","square"]},{"name":"text","type":"string","optional":true,"description":"默认图标下的10px文字"},{"name":"iconStyle","type":"CSSProperties","optional":true,"description":"图标容器样式;color会传给原版SVG图标"},{"name":"className","type":"string","optional":true,"description":"按钮样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"按钮样式"}],"events":[{"name":"onBacktop","type":"(request: BacktopRequest) => void","optional":false,"description":"请求所属滚动容器回到顶部;接收目标时长"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"完全替换默认图标与文字"}],"methods":[],"cssVars":[{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","与滚动容器组合"],"title":"与滚动容器组合","section":"基础用法","description":"将滚动距离传入 `scrollTop`,通过 `onBacktop` 处理回到顶部的滚动请求。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [scrollTop, setScrollTop] = useState(0);\n\nconst [target, setTarget] = useState(0);\n\n<scroll-view\n scroll-y\n style={{ height: '400px' }}\n scroll-top={target}\n bindscroll={(event) => {\n 'background only';\n setScrollTop(event.detail.scrollTop);\n }}\n>\n <view style={{ height: '1200px' }}>\n <text>滚动内容</text>\n </view>\n</scroll-view>\n<Backtop\n scrollTop={scrollTop}\n onBacktop={() => {\n 'background only';\n setTarget(target === 0 ? 0.01 : 0);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [scrollTop, setScrollTop] = useState(0);\n\nconst [target, setTarget] = useState(0);\n\n<scroll-view\n scroll-y\n style={{ height: '400px' }}\n scroll-top={target}\n bindscroll={(event) => {\n 'background only';\n setScrollTop(event.detail.scrollTop);\n }}\n>\n <view style={{ height: '1200px' }}>\n <text>滚动内容</text>\n </view>\n</scroll-view>\n<Backtop\n scrollTop={scrollTop}\n onBacktop={() => {\n 'background only';\n setTarget(target === 0 ? 0.01 : 0);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","方形与文案"],"title":"方形与文案","section":"组件样式","description":"设置 `shape=\"square\"` 使用方形按钮,通过 `text` 设置文字。","language":"tsx","code":"<Backtop\n scrollTop={500}\n shape=\"square\"\n text=\"顶部\"\n onBacktop={(request) => {\n 'background only';\n console.log(request);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Backtop\n scrollTop={500}\n shape=\"square\"\n text=\"顶部\"\n onBacktop={(request) => {\n 'background only';\n console.log(request);\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Badge","id":"badge","label":"Badge 徽标","category":"数据展示","categoryId":"display","kind":"component","description":"徽标用于标记数量、未读或状态,可附着在图标和其他内容旁边。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Badge.tsx","docPath":"docs/ui/components/badge.md","doc":"# Badge 徽标\n\n徽标用于标记数量、未读或状态,可附着在图标和其他内容旁边。\n\n```tsx\nimport { Badge } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 数字与圆点\n\n通过 `value` 设置数字,设置 `isDot` 仅显示圆点;子节点为徽标依附的内容。\n\n```tsx\nimport { Icon } from 'daisu-ui';\n\n<Badge value={5}>\n <Icon name=\"notification\" size={24} />\n</Badge>\n<Badge isDot>\n <Icon name=\"message\" size={24} />\n</Badge>\n```\n\n## 组件样式\n\n### 封顶与状态颜色\n\n通过 `max` 设置显示上限,通过 `type` 设置语义颜色。\n\n```tsx\n<Badge value={120} max={99} type=\"danger\">\n <text>消息</text>\n</Badge>\n```\n\n## 组件状态\n\n### 显示零值\n\n设置 `showZero`,数值为 0 时仍显示徽标。\n\n```tsx\n<Badge value={0} showZero>\n <text>待办</text>\n</Badge>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 数量或自定义文本;未传、空字符串及非有限数不显示数字标记 | `string \\| number` | — |\n| max | 仅截断数值value,超过显示max+;字符串不截断 | `number` | — |\n| top | 相对默认锚点偏移;正top向下、正right向左,数值/纯数字字符串为px,rpx转换vw | `string \\| number` | — |\n| right | 相对默认锚点偏移;正top向下、正right向左,数值/纯数字字符串为px,rpx转换vw | `string \\| number` | — |\n| isDot | 6px点状标记,优先于value与showZero | `boolean` | `false` |\n| hidden | 隐藏标记,保留包裹内容,优先于isDot | `boolean` | `false` |\n| type | info使用浅底深字,其余使用主题颜色与白字 | `'primary' \\| 'success' \\| 'warning' \\| 'danger' \\| 'info'` | `'danger'` |\n| bgColor | 覆盖标记背景 | `string` | — |\n| showZero | 显示数值0或字符串0 | `boolean` | `false` |\n| shape | 胶囊、4px圆角、左下角无圆角的气泡 | `'circle' \\| 'square' \\| 'bubble'` | `'circle'` |\n| border | 1px表面色描边,使用shadow避免改变徽标几何 | `boolean` | `false` |\n| children | 包裹内容;有内容时定位其右上角,无内容时标记参与正常布局 | `ReactNode` | — |\n| className | 外部包裹节点样式,不影响children的点击 | `string` | `''` |\n| style | 外部包裹节点样式,不影响children的点击 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 包裹内容;有内容时定位其右上角,无内容时标记参与正常布局 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-warning` | 共享主题 |\n\n## 源代码\n\n[Badge 组件源码](./sources/badge/Badge.tsx.txt) · [示例源码](./sources/badge/demo.tsx.txt) · [文档源码](./sources/badge/docs.md.txt)\n","demoSource":"import { Badge, Button } from 'daisu-ui';\nimport type { BadgeProps, ButtonTone } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction ButtonBadge({ label = '评论', tone = 'info', ...props }: Omit<BadgeProps, 'children'> & { label?: string; tone?: ButtonTone }) {\n return <Badge className=\"demo-badge-item\" {...props}><Button label={label} tone={tone} size=\"small\" /></Badge>;\n}\n\nexport function BadgeExample() {\n return <view className=\"demo-badge-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"展示消息数量\"><view className=\"demo-badge-row\">\n <ButtonBadge value={12} /><ButtonBadge label=\"回复\" value={3} bgColor=\"green\" /><ButtonBadge value={1} type=\"primary\" /><ButtonBadge label=\"回复\" value={2} type=\"warning\" /><ButtonBadge value={1} type=\"success\" /><ButtonBadge label=\"回复\" value={2} type=\"info\" tone=\"danger\" />\n </view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"点状类型\"><view className=\"demo-badge-row\"><Badge className=\"demo-badge-item\" isDot><text className=\"demo-badge-copy\">数据查询</text></Badge><ButtonBadge label=\"回复\" isDot /></view></ExampleBlock>\n <ExampleBlock title=\"显示0值\"><view className=\"demo-badge-row\"><ButtonBadge value={0} showZero /><ButtonBadge label=\"回复\" value={0} /><ButtonBadge label=\"回复\" value={0} isDot /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"徽标形状\"><view className=\"demo-badge-row\"><ButtonBadge label=\"方形\" value={12} shape=\"square\" /><ButtonBadge label=\"气泡\" value={12} shape=\"bubble\" /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"可定义消息最大值\"><view className=\"demo-badge-row\"><ButtonBadge value={200} max={99} /><ButtonBadge label=\"回复\" value={200} max={10} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"描边徽标\"><view className=\"demo-badge-row\"><ButtonBadge label=\"描边\" value={12} border tone=\"primary\" /><ButtonBadge label=\"描边\" value={1} border type=\"primary\" tone=\"danger\" /><ButtonBadge label=\"描边\" value={999} border type=\"warning\" tone=\"success\" /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"自定义内容\"><view className=\"demo-badge-row\"><ButtonBadge value=\"new\" /><ButtonBadge label=\"回复\" value=\"hot\" /></view></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"value","type":"string | number","optional":true,"description":"数量或自定义文本;未传、空字符串及非有限数不显示数字标记"},{"name":"max","type":"number","optional":true,"description":"仅截断数值value,超过显示max+;字符串不截断"},{"name":"top","type":"string | number","optional":true,"description":"相对默认锚点偏移;正top向下、正right向左,数值/纯数字字符串为px,rpx转换vw"},{"name":"right","type":"string | number","optional":true,"description":"相对默认锚点偏移;正top向下、正right向左,数值/纯数字字符串为px,rpx转换vw"},{"name":"isDot","type":"boolean","optional":true,"description":"6px点状标记,优先于value与showZero","defaultValue":"false","values":[false,true]},{"name":"hidden","type":"boolean","optional":true,"description":"隐藏标记,保留包裹内容,优先于isDot","defaultValue":"false","values":[false,true]},{"name":"type","type":"'primary' | 'success' | 'warning' | 'danger' | 'info'","optional":true,"description":"info使用浅底深字,其余使用主题颜色与白字","defaultValue":"'danger'","values":["primary","success","info","warning","danger"]},{"name":"bgColor","type":"string","optional":true,"description":"覆盖标记背景"},{"name":"showZero","type":"boolean","optional":true,"description":"显示数值0或字符串0","defaultValue":"false","values":[false,true]},{"name":"shape","type":"'circle' | 'square' | 'bubble'","optional":true,"description":"胶囊、4px圆角、左下角无圆角的气泡","defaultValue":"'circle'","values":["circle","square","bubble"]},{"name":"border","type":"boolean","optional":true,"description":"1px表面色描边,使用shadow避免改变徽标几何","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"外部包裹节点样式,不影响children的点击","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"外部包裹节点样式,不影响children的点击"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"包裹内容;有内容时定位其右上角,无内容时标记参与正常布局"}],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"}],"demos":[{"name":"basic","aliases":["demo-1","数字与圆点"],"title":"数字与圆点","section":"组件类型","description":"通过 `value` 设置数字,设置 `isDot` 仅显示圆点;子节点为徽标依附的内容。","language":"tsx","code":"import { Icon } from 'daisu-ui';\n\n<Badge value={5}>\n <Icon name=\"notification\" size={24} />\n</Badge>\n<Badge isDot>\n <Icon name=\"message\" size={24} />\n</Badge>\n","blocks":[{"language":"tsx","code":"import { Icon } from 'daisu-ui';\n\n<Badge value={5}>\n <Icon name=\"notification\" size={24} />\n</Badge>\n<Badge isDot>\n <Icon name=\"message\" size={24} />\n</Badge>\n"}]},{"name":"demo-2","aliases":["demo-2","封顶与状态颜色"],"title":"封顶与状态颜色","section":"组件样式","description":"通过 `max` 设置显示上限,通过 `type` 设置语义颜色。","language":"tsx","code":"<Badge value={120} max={99} type=\"danger\">\n <text>消息</text>\n</Badge>\n","blocks":[{"language":"tsx","code":"<Badge value={120} max={99} type=\"danger\">\n <text>消息</text>\n</Badge>\n"}]},{"name":"demo-3","aliases":["demo-3","显示零值"],"title":"显示零值","section":"组件状态","description":"设置 `showZero`,数值为 0 时仍显示徽标。","language":"tsx","code":"<Badge value={0} showZero>\n <text>待办</text>\n</Badge>\n","blocks":[{"language":"tsx","code":"<Badge value={0} showZero>\n <text>待办</text>\n</Badge>\n"}]}],"allowUnknownProps":false},{"name":"BarCode","id":"bar-code","label":"BarCode 条形码","category":"数据展示","categoryId":"display","kind":"component","description":"条形码用于展示可扫描的商品或业务编码,支持不同编码格式及文字展示。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/BarCode.tsx","docPath":"docs/ui/components/bar-code.md","doc":"# BarCode 条形码\n\n条形码用于展示可扫描的商品或业务编码,支持不同编码格式及文字展示。\n\n```tsx\nimport { BarCode } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 生成条形码\n\n通过 `value` 设置要编码的内容。\n\n```tsx\n<BarCode value=\"123456789012\" />\n```\n\n## 组件样式\n\n### 尺寸与颜色\n\n通过 `height` 设置条码高度,通过 `lineColor` 设置条纹颜色。\n\n```tsx\n<BarCode value=\"123456789012\" height={80} lineColor=\"#1c64fd\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | string / number;空值不显示,0 是有效内容,最多128字符 | `string \\| number` | — |\n| format | auto、CODE128、CODE128A、CODE128B、CODE128C、EAN13、EAN8、UPC、UPCE、CODE39、ITF14、MSI、MSI10、MSI11、MSI1010、MSI1110、pharmacode、codabar | `BarCodeFormat` | — |\n| width | 整体尺寸,单位px,必须为有限正数;包括留白、条纹和文字。不是单根条纹宽度 | `number` | — |\n| height | 整体尺寸,单位px,必须为有限正数;包括留白、条纹和文字。不是单根条纹宽度 | `number` | — |\n| text | 自定义显示文字;默认使用编码后的文字,包括自动计算的校验位 | `string` | — |\n| font | 原生字体与最大字号;文本通过独立原生布局测量,宽度不足时缩小字号;字体实际效果取决于宿主可用字体 | `string` | — |\n| fontSize | 原生字体与最大字号;文本通过独立原生布局测量,宽度不足时缩小字号;字体实际效果取决于宿主可用字体 | `number` | — |\n| fontOptions | bold / italic / bold italic | `'' \\| 'bold' \\| 'italic' \\| 'bold italic'` | — |\n| textMargin | 条纹与文字间距,非负有限数字 | `number` | — |\n| background | 背景色与条纹/文字颜色 | `string` | — |\n| lineColor | 背景色与条纹/文字颜色 | `string` | — |\n| margin | 四边留白,非负有限数字 | `number` | — |\n| marginTop | 各边留白,允许0 | `number` | — |\n| marginBottom | 各边留白,允许0 | `number` | — |\n| marginLeft | 各边留白,允许0 | `number` | — |\n| marginRight | 各边留白,允许0 | `number` | — |\n| displayValue | 是否展示文字 | `boolean` | — |\n| textAlign | left / center / right;EAN13/EAN8/UPC/UPCE 默认数字保持分段居中,自定义text时使用该参数 | `'left' \\| 'center' \\| 'right'` | — |\n| textPosition | top / bottom | `'top' \\| 'bottom'` | — |\n| className | 根容器扩展;改变绘图尺寸请使用width/height | `string` | `''` |\n| style | 根容器扩展;改变绘图尺寸请使用width/height | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onValid | 对应操作发生时触发 | (valid: boolean) => void |\n| onError | 发生错误时触发 | (error: Error) => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| exportImage | 调用实例方法 | () => Promise<string> |\n| getSvg | 调用实例方法 | () => string |\n\n## 数据类型\n\n```tsx\nexport type BarCodeFormat = (typeof barCodeFormats)[number];\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[BarCode 组件源码](./sources/bar-code/BarCode.tsx.txt) · [示例源码](./sources/bar-code/demo.tsx.txt) · [文档源码](./sources/bar-code/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { BarCode, Button, Icon } from 'daisu-ui';\nimport type { BarCodeFormat, BarCodeProps, BarCodeRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst formats: {label: BarCodeFormat; value: string}[] = [\n {label:'CODE128',value:'CODE128'},{label:'CODE128A',value:'CODE128A'},{label:'CODE128B',value:'CODE128B'},{label:'CODE128C',value:'123456'},\n {label:'EAN13',value:'690123456789'},{label:'EAN8',value:'1234567'},{label:'UPC',value:'12345678901'},{label:'UPCE',value:'123456'},\n {label:'CODE39',value:'CODE39'},{label:'ITF14',value:'1234567890123'},{label:'MSI',value:'123456'},{label:'MSI10',value:'123456'},\n {label:'MSI11',value:'123456'},{label:'MSI1010',value:'123456'},{label:'MSI1110',value:'123456'},{label:'pharmacode',value:'1234'},{label:'codabar',value:'A123456A'},\n];\nfunction Item({label,...props}:BarCodeProps&{label?:string}) { return <view className=\"demo-bar-code-item\">{label?<text className=\"demo-bar-code-label\">{label}</text>:null}<BarCode value=\"1234567890\" {...props}/></view>; }\nexport function BarCodeExample(){\n const ref=useRef<BarCodeRef>(null),[exported,setExported]=useState(''),[error,setError]=useState('');\n const exportImage=async()=>{ 'background only';try{const url=await ref.current!.exportImage();setExported(decodeURIComponent(url.slice(url.indexOf(',')+1)));setError('');}catch(e){setError(e instanceof Error?e.message:String(e));} };\n return <view className=\"demo-bar-code-page\"><DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><Item/></ExampleBlock>\n <ExampleBlock title=\"常见格式\">{[formats[4]!,formats[8]!,formats[9]!].map(item=><Item key={item.label} label={item.label} value={item.value} format={item.label}/>)}</ExampleBlock>\n <ExampleBlock title=\"导出图片\"><view className=\"demo-bar-code-item\"><BarCode ref={ref} value=\"1234567890\"/><Button className=\"demo-bar-code-export\" size=\"small\" icon={<Icon name=\"download\" size={14}/>} label=\"导出图片\" onTap={exportImage}/>{exported?<svg className=\"demo-bar-code-export-image\" content={exported} style={{width:'200px',height:'100px'}}/>:null}{error?<text>{error}</text>:null}</view></ExampleBlock>\n </DemoGroup><DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"文字位置\"><Item label=\"文字在上方\" textPosition=\"top\"/><Item label=\"文字在下方\" textPosition=\"bottom\"/></ExampleBlock>\n <ExampleBlock title=\"文字间距\"><Item textMargin={10}/></ExampleBlock>\n <ExampleBlock title=\"隐藏文字\"><Item displayValue={false}/></ExampleBlock>\n </DemoGroup><DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义颜色\"><Item lineColor=\"#4D80F0\" background=\"#E0EAFF\"/></ExampleBlock>\n <ExampleBlock title=\"自定义尺寸\"><Item width={260} height={80}/><Item label=\"长条紧凑尺寸\" width={320} height={50}/><Item label=\"更高的条码\" height={140}/><Item label=\"紧凑尺寸\" height={60} displayValue={false}/></ExampleBlock>\n <ExampleBlock title=\"数字大小\"><Item label=\"font-size: 14\" fontSize={14}/><Item label=\"font-size: 24\" fontSize={24}/></ExampleBlock>\n <ExampleBlock title=\"字体样式\"><Item label=\"bold italic\" fontOptions=\"bold italic\"/><Item label=\"font-size: 18 + bold\" fontSize={18} fontOptions=\"bold\"/></ExampleBlock>\n </DemoGroup><DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"支持格式\">{formats.map(item=><Item key={item.label} label={item.label} value={item.value} format={item.label}/>)}</ExampleBlock>\n <ExampleBlock title=\"特殊格式尺寸\">{[{...formats[5]!,width:240,height:140},{...formats[6]!,width:280,height:150},{...formats[7]!,width:220,height:130}].map(item=><Item key={item.label} label={item.label} value={item.value} format={item.label} width={item.width} height={item.height}/>)}</ExampleBlock>\n </DemoGroup></view>;\n}\n","props":[{"name":"value","type":"string | number","optional":true,"description":"string / number;空值不显示,0 是有效内容,最多128字符"},{"name":"format","type":"BarCodeFormat","optional":true,"description":"auto、CODE128、CODE128A、CODE128B、CODE128C、EAN13、EAN8、UPC、UPCE、CODE39、ITF14、MSI、MSI10、MSI11、MSI1010、MSI1110、pharmacode、codabar","values":["auto","CODE128","CODE128A","CODE128B","CODE128C","EAN13","EAN8","UPC","UPCE","CODE39","ITF14","MSI","MSI10","MSI11","MSI1010","MSI1110","pharmacode","codabar"]},{"name":"width","type":"number","optional":true,"description":"整体尺寸,单位px,必须为有限正数;包括留白、条纹和文字。不是单根条纹宽度"},{"name":"height","type":"number","optional":true,"description":"整体尺寸,单位px,必须为有限正数;包括留白、条纹和文字。不是单根条纹宽度"},{"name":"text","type":"string","optional":true,"description":"自定义显示文字;默认使用编码后的文字,包括自动计算的校验位"},{"name":"font","type":"string","optional":true,"description":"原生字体与最大字号;文本通过独立原生布局测量,宽度不足时缩小字号;字体实际效果取决于宿主可用字体"},{"name":"fontSize","type":"number","optional":true,"description":"原生字体与最大字号;文本通过独立原生布局测量,宽度不足时缩小字号;字体实际效果取决于宿主可用字体"},{"name":"fontOptions","type":"'' | 'bold' | 'italic' | 'bold italic'","optional":true,"description":"bold / italic / bold italic","values":["","bold","italic","bold italic"]},{"name":"textMargin","type":"number","optional":true,"description":"条纹与文字间距,非负有限数字"},{"name":"background","type":"string","optional":true,"description":"背景色与条纹/文字颜色"},{"name":"lineColor","type":"string","optional":true,"description":"背景色与条纹/文字颜色"},{"name":"margin","type":"number","optional":true,"description":"四边留白,非负有限数字"},{"name":"marginTop","type":"number","optional":true,"description":"各边留白,允许0"},{"name":"marginBottom","type":"number","optional":true,"description":"各边留白,允许0"},{"name":"marginLeft","type":"number","optional":true,"description":"各边留白,允许0"},{"name":"marginRight","type":"number","optional":true,"description":"各边留白,允许0"},{"name":"displayValue","type":"boolean","optional":true,"description":"是否展示文字","values":[false,true]},{"name":"textAlign","type":"'left' | 'center' | 'right'","optional":true,"description":"left / center / right;EAN13/EAN8/UPC/UPCE 默认数字保持分段居中,自定义text时使用该参数","values":["left","right","center"]},{"name":"textPosition","type":"'top' | 'bottom'","optional":true,"description":"top / bottom","values":["bottom","top"]},{"name":"className","type":"string","optional":true,"description":"根容器扩展;改变绘图尺寸请使用width/height","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根容器扩展;改变绘图尺寸请使用width/height"}],"events":[{"name":"onValid","type":"(valid: boolean) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onError","type":"(error: Error) => void","optional":true,"description":"发生错误时触发"}],"slots":[],"methods":[{"name":"exportImage","description":"调用实例方法","type":"() => Promise<string>"},{"name":"getSvg","description":"调用实例方法","type":"() => string"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","生成条形码"],"title":"生成条形码","section":"基础用法","description":"通过 `value` 设置要编码的内容。","language":"tsx","code":"<BarCode value=\"123456789012\" />\n","blocks":[{"language":"tsx","code":"<BarCode value=\"123456789012\" />\n"}]},{"name":"demo-2","aliases":["demo-2","尺寸与颜色"],"title":"尺寸与颜色","section":"组件样式","description":"通过 `height` 设置条码高度,通过 `lineColor` 设置条纹颜色。","language":"tsx","code":"<BarCode value=\"123456789012\" height={80} lineColor=\"#1c64fd\" />\n","blocks":[{"language":"tsx","code":"<BarCode value=\"123456789012\" height={80} lineColor=\"#1c64fd\" />\n"}]}],"allowUnknownProps":false},{"name":"Button","id":"button","label":"Button 按钮","category":"基础","categoryId":"basic","kind":"component","description":"按钮用于触发操作,例如提交表单、确认选择或打开页面。支持语义颜色、多种外观、加载状态和图标内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Button.tsx","docPath":"docs/ui/components/button.md","doc":"# Button 按钮\n\n按钮用于触发操作,例如提交表单、确认选择或打开页面。支持语义颜色、多种外观、加载状态和图标内容。\n\n```tsx\nimport { Button } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 类型\n\n通过 `tone` 设置按钮的语义颜色,默认为 `primary`。\n\n```tsx\n<Button label=\"主要按钮\" />\n<Button label=\"成功按钮\" tone=\"success\" />\n<Button label=\"信息按钮\" tone=\"info\" />\n<Button label=\"警告按钮\" tone=\"warning\" />\n<Button label=\"危险按钮\" tone=\"danger\" />\n<Button label=\"中性按钮\" tone=\"neutral\" />\n```\n\n## 组件状态\n\n### 禁用\n\n设置 `disabled` 后,按钮会降低透明度并停止响应点击。\n\n```tsx\n<Button label=\"默认按钮\" disabled />\n```\n\n### 加载\n\n设置 `loading` 显示加载指示器。加载期间不会触发 `onTap`,适合防止操作重复提交。\n\n```tsx\n<Button label=\"加载中\" loading />\n<Button label=\"加载中\" tone=\"success\" variant=\"plain\" loading />\n```\n\n## 组件变体\n\n使用 `variant` 设置外观,各种变体均可与 `tone`、`disabled` 和 `loading` 组合。\n\n### 实心\n\n默认的 `solid` 变体,用于页面主要操作。\n\n```tsx\n<Button label=\"主要按钮\" variant=\"solid\" />\n```\n\n### 镂空\n\n`plain` 使用透明背景和实线边框。\n\n```tsx\n<Button label=\"主要按钮\" variant=\"plain\" />\n```\n\n### 虚线\n\n`dashed` 使用透明背景和虚线边框。\n\n```tsx\n<Button label=\"添加项目\" variant=\"dashed\" />\n```\n\n### 柔和\n\n`soft` 使用浅色背景,降低按钮的视觉强调程度。\n\n```tsx\n<Button label=\"主要按钮\" variant=\"soft\" />\n```\n\n### 柔和描边\n\n`subtle` 在浅色背景上增加同色边框。\n\n```tsx\n<Button label=\"主要按钮\" variant=\"subtle\" />\n```\n\n### 文字\n\n`text` 使用透明背景,不显示边框。\n\n```tsx\n<Button label=\"查看详情\" variant=\"text\" />\n```\n\n## 组件样式\n\n### 尺寸\n\n`size` 支持 `mini`、`small`、`medium` 和 `large`,默认值为 `medium`。默认高度依次为 28、32、40 和 44px。\n\n```tsx\n<Button label=\"迷你按钮\" size=\"mini\" />\n<Button label=\"小号按钮\" size=\"small\" />\n<Button label=\"普通按钮\" size=\"medium\" />\n<Button label=\"大号按钮\" size=\"large\" />\n```\n\n### 细边框与圆角\n\n设置 `hairline` 将描边宽度设为 0.5px;设置 `round` 使用胶囊形圆角。\n\n```tsx\n<Button label=\"细边框\" variant=\"plain\" hairline />\n<Button label=\"圆角按钮\" variant=\"plain\" round />\n<Button label=\"圆角细边框\" variant=\"plain\" hairline round />\n```\n\n## 特殊样式\n\n### 自定义类名\n\n使用 `className` 添加业务需要的样式。\n\n```tsx\n<Button label=\"主要按钮\" className=\"custom-button\" />\n```\n\n```css\n.custom-button {\n width: 160px;\n margin-top: 16px;\n}\n```\n\n## 内容形态\n\n### 文本按钮\n\n通过 `label` 设置文本内容。\n\n```tsx\n<Button label=\"确认\" />\n<Button label=\"取消\" tone=\"info\" />\n```\n\n### 纯图标按钮\n\n`icon` 接收 React 节点。仅传入图标时,按钮宽度与当前尺寸的高度相同。建议为纯图标按钮设置 `accessibilityLabel`,让读屏工具能够说明操作用途。\n\n```tsx\nimport { Button, Icon } from 'daisu-ui';\n\n<Button\n icon={<Icon name=\"delete\" color=\"#ffffff\" />}\n accessibilityLabel=\"删除\"\n round\n/>\n```\n\n### 图文按钮\n\n同时设置 `icon` 和 `label`,图标会显示在文字前面。加载时,加载指示器会替代图标。\n\n```tsx\n<Button\n label=\"下载\"\n icon={<Icon name=\"download\" color=\"#ffffff\" />}\n/>\n```\n\n## 布局能力\n\n### 块级按钮\n\n设置 `block` 占满父容器宽度,适合表单底部的提交操作。\n\n```tsx\n<Button label=\"提交\" block size=\"large\" />\n<Button label=\"确认提交\" block size=\"large\" round />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| label | 按钮文本 | `string` | — |\n| tone | 语义颜色 | `primary` / `success` / `info` / `warning` / `danger` / `neutral` | `primary` |\n| variant | 按钮外观 | `solid` / `plain` / `dashed` / `soft` / `subtle` / `text` | `solid` |\n| size | 按钮尺寸 | `mini` / `small` / `medium` / `large` | `medium` |\n| round | 胶囊形圆角 | `boolean` | `false` |\n| disabled | 禁用状态 | `boolean` | `false` |\n| loading | 加载状态,同时阻止点击 | `boolean` | `false` |\n| hairline | 将描边宽度设为 0.5px | `boolean` | `false` |\n| block | 占满父容器宽度 | `boolean` | `false` |\n| icon | 前置图标内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| accessibilityLabel | 读屏描述 | `string` | 跟随 `label` |\n\n`tone`、`variant`、`size` 和 `round` 可通过 [ConfigProvider 全局配置](config-provider.md) 设置默认值,按钮自身传入的属性优先。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onTap | 点击按钮时触发;禁用或加载期间不触发 | `() => void` |\n\n```tsx\n<Button label=\"确认\" onTap={() => {\n 'background only';\n console.log('确认操作');\n}} />\n```\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| icon | 文字前的自定义图标;加载期间由加载指示器替代 | `ReactNode` |\n\n文本内容通过 `label` 设置。\n\n## 主题定制\n\n### 全局配置\n\n在 `ConfigProvider` 中统一设置按钮默认样式与主题变量。\n\n```tsx\nimport { Button, ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider\n button={{ round: true, size: 'large' }}\n themeVars={{\n buttonPrimaryBg: '#f86100',\n buttonPrimaryColor: '#ffffff',\n buttonRadius: 8,\n }}\n>\n <Button label=\"确认提交\" />\n</ConfigProvider>\n```\n\n### CSS 变量\n\n| 变量 | 默认值 | 说明 |\n| --- | --- | --- |\n| --cso-ui-button-primary-bg | 跟随 `--cso-ui-primary` | 主要按钮背景色 |\n| --cso-ui-button-primary-color | 跟随 `--cso-ui-on-primary` | 主要按钮文字与加载指示器颜色 |\n| --cso-ui-button-height | `40px` | 默认尺寸的高度 |\n| --cso-ui-button-font-size | `16px` | 默认尺寸的字号 |\n| --cso-ui-button-radius | `4px` | 默认圆角 |\n| --cso-ui-button-pressed-opacity | `0.85` | 实心按钮按压透明度 |\n\n语义颜色跟随 `ConfigProvider` 的明暗主题;`mini`、`small`、`large` 会使用各自的高度与内边距。\n\n## 源代码\n\n[组件源码](./sources/Button.tsx.txt) · [示例源码](./sources/button-demo.tsx.txt) · [文档源码](./sources/button.md.txt)\n","demoSource":"import { Button } from 'daisu-ui';\nimport type { ButtonProps, ButtonSize, ButtonTone, ButtonVariant } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst types = [\n { tone: 'primary', label: '主要按钮' },\n { tone: 'success', label: '成功按钮' },\n { tone: 'info', label: '信息按钮' },\n { tone: 'warning', label: '警告按钮' },\n { tone: 'danger', label: '危险按钮' },\n] as const;\n\nconst glyphPaths = {\n delete: '<path d=\"M3 6h18M9 6V3h6v3M6 6l1 15h10l1-15M10 10v7M14 10v7\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5\"/>',\n settings: '<path d=\"m9 3-1 3-3 1-2 3 2 2-1 3 3 2 1 3h4l1-3 3-1 2-3-2-2 1-3-3-2-1-3H9Z\"/><circle cx=\"10\" cy=\"11\" r=\"3\"/>',\n recycle: '<path d=\"m8 6 4-4 5 8M3 14l3-5 4 1M7 21H2l2-8m17-1 1 6h-9m5-8 4 2-1 5M7 18l-1 3 7 1\"/>',\n};\nconst colors: Record<string, [string, string]> = {\n primary: ['#1c64fd', '#5b90ff'], success: ['#12b886', '#20c997'], info: ['#1d1f29', '#f7f8fa'],\n warning: ['#f57f00', '#ffa94d'], danger: ['#f14646', '#ff6b6b'],\n};\n\nfunction ButtonGlyph({ name, tone = 'primary', variant = 'solid' }: { name: keyof typeof glyphPaths; tone?: ButtonTone; variant?: ButtonVariant }) {\n const [light, dark] = variant === 'solid' && tone !== 'info' ? ['#ffffff', '#ffffff'] : colors[tone] ?? colors.primary!;\n const markup = (color: string) => `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"${color}\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${glyphPaths[name]}</svg>`;\n return <view className=\"demo-button-glyph\"><svg className=\"ui-demo-icon-light\" content={markup(light!)} /><svg className=\"ui-demo-icon-dark\" content={markup(dark!)} /></view>;\n}\n\nfunction TypeRow({ variant = 'solid', loading = false, ...props }: Omit<ButtonProps, 'tone' | 'label'>) {\n return <view className=\"demo-button-row\">{types.map(item => <Button key={item.tone} {...item} {...props} variant={variant} loading={loading} label={loading ? '加载中' : variant === 'text' ? '按钮' : item.label} />)}</view>;\n}\n\nexport function ButtonExample() {\n return <view className=\"demo-button-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"类型\"><TypeRow /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"禁用\"><TypeRow disabled /></ExampleBlock>\n <ExampleBlock title=\"加载\">\n <view className=\"demo-button-subrow\"><TypeRow loading /></view>\n <view className=\"demo-button-subrow\"><view className=\"demo-button-row\">{(['success', 'warning', 'danger', 'info'] as const).map(tone => <Button key={tone} tone={tone} variant=\"plain\" loading label=\"加载中\" />)}</view></view>\n </ExampleBlock>\n <ExampleBlock title=\"变体禁用\"><view className=\"demo-button-row\">{types.map((item, index) => <Button key={item.tone} {...item} variant={index < 2 ? 'plain' : index < 4 ? 'dashed' : 'text'} disabled />)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\">\n {([{ title: '镂空', variant: 'plain' }, { title: '虚线', variant: 'dashed' }, { title: '柔和', variant: 'soft' }, { title: '柔和描边', variant: 'subtle' }, { title: '文字', variant: 'text' }] as const).map(item => <ExampleBlock key={item.variant} title={item.title}><TypeRow variant={item.variant} /></ExampleBlock>)}\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"尺寸\"><view className=\"demo-button-row\">{([{ size: 'mini', label: '迷你按钮' }, { size: 'small', label: '小型按钮' }, { size: 'medium', label: '普通按钮' }, { size: 'large', label: '大型按钮' }] as const).map(item => <Button key={item.size} {...item} />)}</view></ExampleBlock>\n <ExampleBlock title=\"细边框与圆角\"><view className=\"demo-button-subrow\"><TypeRow variant=\"plain\" hairline /></view><view className=\"demo-button-subrow\"><TypeRow variant=\"plain\" hairline round /></view></ExampleBlock>\n <ExampleBlock title=\"圆角对比\"><view className=\"demo-button-subrow\"><TypeRow variant=\"plain\" round /></view><view className=\"demo-button-subrow\"><TypeRow variant=\"dashed\" round /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"custom-class 阴影\"><TypeRow className=\"demo-button-shadow\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\">\n <ExampleBlock title=\"文本按钮\"><view className=\"demo-button-row\"><Button label=\"默认按钮\" /><Button label=\"成功按钮\" tone=\"success\" /></view></ExampleBlock>\n <ExampleBlock title=\"纯图标按钮\">{(['solid', 'plain', 'plain', 'solid'] as const).map((variant, row) => <view key={row} className=\"demo-button-subrow\"><view className=\"demo-button-row\">{types.map((item, index) => <Button key={item.tone} tone={item.tone} variant={variant} round={row > 1} size={row === 3 ? (['large', 'medium', 'small', 'mini', 'small'] as ButtonSize[])[index] : 'medium'} icon={<ButtonGlyph name=\"delete\" tone={item.tone} variant={variant} />} accessibilityLabel={`删除(${item.label})`} />)}</view></view>)}</ExampleBlock>\n <ExampleBlock title=\"图文按钮\"><view className=\"demo-button-row\">{([{ name: 'download', label: '下载', size: 'medium' }, { name: 'settings', label: '设置', size: 'medium' }, { name: 'recycle', label: '可回收', size: 'medium' }, { name: 'download', label: '下载', size: 'small' }, { name: 'settings', label: '设置', size: 'small' }, { name: 'download', label: '下载', size: 'large' }, { name: 'settings', label: '设置', size: 'large' }] as const).map((item, index) => <Button key={index} label={item.label} size={item.size} icon={<ButtonGlyph name={item.name} />} />)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"块级按钮\"><view className=\"demo-button-blocks\">{types.map(item => <Button key={item.tone} {...item} block size=\"large\" />)}</view></ExampleBlock>\n <ExampleBlock title=\"块级圆角组合\"><view className=\"demo-button-blocks\"><Button label=\"主要按钮\" block size=\"large\" round disabled /><Button label=\"主要按钮\" block size=\"large\" round /><Button label=\"主要按钮\" block size=\"large\" round loading /><Button label=\"信息按钮\" tone=\"info\" block size=\"large\" round disabled /><Button label=\"信息按钮\" tone=\"info\" block size=\"large\" round /></view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"label","type":"string","optional":true,"description":"按钮文本"},{"name":"tone","type":"ButtonTone","optional":true,"description":"语义颜色","defaultValue":"primary","values":["primary","success","info","warning","danger","neutral"]},{"name":"variant","type":"ButtonVariant","optional":true,"description":"按钮外观","defaultValue":"solid","values":["solid","plain","dashed","soft","subtle","text"]},{"name":"size","type":"ButtonSize","optional":true,"description":"按钮尺寸","defaultValue":"medium","values":["mini","small","medium","large"]},{"name":"block","type":"boolean","optional":true,"description":"占满父容器宽度","defaultValue":"false","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态,同时阻止点击","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"禁用状态","defaultValue":"false","values":[false,true]},{"name":"icon","type":"ReactNode","optional":true,"description":"文字前的自定义图标;加载期间由加载指示器替代"},{"name":"round","type":"boolean","optional":true,"description":"胶囊形圆角","defaultValue":"false","values":[false,true]},{"name":"hairline","type":"boolean","optional":true,"description":"将描边宽度设为 0.5px","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"accessibilityLabel","type":"string","optional":true,"description":"读屏描述","defaultValue":"跟随 label"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":"点击按钮时触发;禁用或加载期间不触发"}],"slots":[{"name":"icon","type":"ReactNode","optional":true,"description":"文字前的自定义图标;加载期间由加载指示器替代"}],"methods":[],"cssVars":[{"name":"--cso-ui-button-font-size","defaultValue":"16px","description":"默认尺寸的字号"},{"name":"--cso-ui-button-height","defaultValue":"40px","description":"默认尺寸的高度"},{"name":"--cso-ui-button-pressed-opacity","defaultValue":"0.85","description":"实心按钮按压透明度"},{"name":"--cso-ui-button-primary-bg","defaultValue":"跟随 --cso-ui-primary","description":"主要按钮背景色"},{"name":"--cso-ui-button-primary-color","defaultValue":"跟随 --cso-ui-on-primary","description":"主要按钮文字与加载指示器颜色"},{"name":"--cso-ui-button-radius","defaultValue":"4px","description":"默认圆角"},{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-danger-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-danger-soft","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-danger-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-line-strong","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-on-primary","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#16110d"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-primary-soft","defaultValue":"#fff3eb","description":""},{"name":"--cso-ui-primary-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-success-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-success-soft","defaultValue":"#f3fbf9","description":""},{"name":"--cso-ui-success-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"},{"name":"--cso-ui-warning-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-warning-soft","defaultValue":"#fff6eb","description":""},{"name":"--cso-ui-warning-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","类型"],"title":"类型","section":"组件类型","description":"通过 `tone` 设置按钮的语义颜色,默认为 `primary`。","language":"tsx","code":"<Button label=\"主要按钮\" />\n<Button label=\"成功按钮\" tone=\"success\" />\n<Button label=\"信息按钮\" tone=\"info\" />\n<Button label=\"警告按钮\" tone=\"warning\" />\n<Button label=\"危险按钮\" tone=\"danger\" />\n<Button label=\"中性按钮\" tone=\"neutral\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" />\n<Button label=\"成功按钮\" tone=\"success\" />\n<Button label=\"信息按钮\" tone=\"info\" />\n<Button label=\"警告按钮\" tone=\"warning\" />\n<Button label=\"危险按钮\" tone=\"danger\" />\n<Button label=\"中性按钮\" tone=\"neutral\" />\n"}]},{"name":"demo-2","aliases":["demo-2","禁用"],"title":"禁用","section":"组件状态","description":"设置 `disabled` 后,按钮会降低透明度并停止响应点击。","language":"tsx","code":"<Button label=\"默认按钮\" disabled />\n","blocks":[{"language":"tsx","code":"<Button label=\"默认按钮\" disabled />\n"}]},{"name":"demo-3","aliases":["demo-3","加载"],"title":"加载","section":"组件状态","description":"设置 `loading` 显示加载指示器。加载期间不会触发 `onTap`,适合防止操作重复提交。","language":"tsx","code":"<Button label=\"加载中\" loading />\n<Button label=\"加载中\" tone=\"success\" variant=\"plain\" loading />\n","blocks":[{"language":"tsx","code":"<Button label=\"加载中\" loading />\n<Button label=\"加载中\" tone=\"success\" variant=\"plain\" loading />\n"}]},{"name":"demo-4","aliases":["demo-4","实心"],"title":"实心","section":"组件变体","description":"默认的 `solid` 变体,用于页面主要操作。","language":"tsx","code":"<Button label=\"主要按钮\" variant=\"solid\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" variant=\"solid\" />\n"}]},{"name":"demo-5","aliases":["demo-5","镂空"],"title":"镂空","section":"组件变体","description":"`plain` 使用透明背景和实线边框。","language":"tsx","code":"<Button label=\"主要按钮\" variant=\"plain\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" variant=\"plain\" />\n"}]},{"name":"demo-6","aliases":["demo-6","虚线"],"title":"虚线","section":"组件变体","description":"`dashed` 使用透明背景和虚线边框。","language":"tsx","code":"<Button label=\"添加项目\" variant=\"dashed\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"添加项目\" variant=\"dashed\" />\n"}]},{"name":"demo-7","aliases":["demo-7","柔和"],"title":"柔和","section":"组件变体","description":"`soft` 使用浅色背景,降低按钮的视觉强调程度。","language":"tsx","code":"<Button label=\"主要按钮\" variant=\"soft\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" variant=\"soft\" />\n"}]},{"name":"demo-8","aliases":["demo-8","柔和描边"],"title":"柔和描边","section":"组件变体","description":"`subtle` 在浅色背景上增加同色边框。","language":"tsx","code":"<Button label=\"主要按钮\" variant=\"subtle\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" variant=\"subtle\" />\n"}]},{"name":"demo-9","aliases":["demo-9","文字"],"title":"文字","section":"组件变体","description":"`text` 使用透明背景,不显示边框。","language":"tsx","code":"<Button label=\"查看详情\" variant=\"text\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"查看详情\" variant=\"text\" />\n"}]},{"name":"demo-10","aliases":["demo-10","尺寸"],"title":"尺寸","section":"组件样式","description":"`size` 支持 `mini`、`small`、`medium` 和 `large`,默认值为 `medium`。默认高度依次为 28、32、40 和 44px。","language":"tsx","code":"<Button label=\"迷你按钮\" size=\"mini\" />\n<Button label=\"小号按钮\" size=\"small\" />\n<Button label=\"普通按钮\" size=\"medium\" />\n<Button label=\"大号按钮\" size=\"large\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"迷你按钮\" size=\"mini\" />\n<Button label=\"小号按钮\" size=\"small\" />\n<Button label=\"普通按钮\" size=\"medium\" />\n<Button label=\"大号按钮\" size=\"large\" />\n"}]},{"name":"demo-11","aliases":["demo-11","细边框与圆角"],"title":"细边框与圆角","section":"组件样式","description":"设置 `hairline` 将描边宽度设为 0.5px;设置 `round` 使用胶囊形圆角。","language":"tsx","code":"<Button label=\"细边框\" variant=\"plain\" hairline />\n<Button label=\"圆角按钮\" variant=\"plain\" round />\n<Button label=\"圆角细边框\" variant=\"plain\" hairline round />\n","blocks":[{"language":"tsx","code":"<Button label=\"细边框\" variant=\"plain\" hairline />\n<Button label=\"圆角按钮\" variant=\"plain\" round />\n<Button label=\"圆角细边框\" variant=\"plain\" hairline round />\n"}]},{"name":"demo-12","aliases":["demo-12","自定义类名"],"title":"自定义类名","section":"特殊样式","description":"使用 `className` 添加业务需要的样式。","language":"tsx","code":"<Button label=\"主要按钮\" className=\"custom-button\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"主要按钮\" className=\"custom-button\" />\n"},{"language":"css","code":".custom-button {\n width: 160px;\n margin-top: 16px;\n}\n"}]},{"name":"demo-13","aliases":["demo-13","文本按钮"],"title":"文本按钮","section":"内容形态","description":"通过 `label` 设置文本内容。","language":"tsx","code":"<Button label=\"确认\" />\n<Button label=\"取消\" tone=\"info\" />\n","blocks":[{"language":"tsx","code":"<Button label=\"确认\" />\n<Button label=\"取消\" tone=\"info\" />\n"}]},{"name":"demo-14","aliases":["demo-14","纯图标按钮"],"title":"纯图标按钮","section":"内容形态","description":"`icon` 接收 React 节点。仅传入图标时,按钮宽度与当前尺寸的高度相同。建议为纯图标按钮设置 `accessibilityLabel`,让读屏工具能够说明操作用途。","language":"tsx","code":"import { Button, Icon } from 'daisu-ui';\n\n<Button\n icon={<Icon name=\"delete\" color=\"#ffffff\" />}\n accessibilityLabel=\"删除\"\n round\n/>\n","blocks":[{"language":"tsx","code":"import { Button, Icon } from 'daisu-ui';\n\n<Button\n icon={<Icon name=\"delete\" color=\"#ffffff\" />}\n accessibilityLabel=\"删除\"\n round\n/>\n"}]},{"name":"demo-15","aliases":["demo-15","图文按钮"],"title":"图文按钮","section":"内容形态","description":"同时设置 `icon` 和 `label`,图标会显示在文字前面。加载时,加载指示器会替代图标。","language":"tsx","code":"<Button\n label=\"下载\"\n icon={<Icon name=\"download\" color=\"#ffffff\" />}\n/>\n","blocks":[{"language":"tsx","code":"<Button\n label=\"下载\"\n icon={<Icon name=\"download\" color=\"#ffffff\" />}\n/>\n"}]},{"name":"demo-16","aliases":["demo-16","块级按钮"],"title":"块级按钮","section":"布局能力","description":"设置 `block` 占满父容器宽度,适合表单底部的提交操作。","language":"tsx","code":"<Button label=\"提交\" block size=\"large\" />\n<Button label=\"确认提交\" block size=\"large\" round />\n","blocks":[{"language":"tsx","code":"<Button label=\"提交\" block size=\"large\" />\n<Button label=\"确认提交\" block size=\"large\" round />\n"}]}],"allowUnknownProps":false},{"name":"Calendar","id":"calendar","label":"Calendar 日历选择器","category":"录入","categoryId":"form","kind":"component","description":"日历选择器通过弹层提供单日、日期范围和多种日期选择模式,适合预约与筛选。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Calendar.tsx","docPath":"docs/ui/components/calendar.md","doc":"# Calendar 日历选择器\n\n日历选择器通过弹层提供单日、日期范围和多种日期选择模式,适合预约与筛选。\n\n```tsx\nimport { Calendar } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 弹层日历\n\n通过 `visible` 控制日历弹层,`type=\"date\"` 使用单日模式,`onConfirm` 返回选择的日期。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择日期\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Calendar\n visible={visible}\n onVisibleChange={setVisible}\n type=\"date\"\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件变体\n\n### 日期范围\n\n设置 `type=\"daterange\"` 选择日期范围,通过 `title` 设置面板标题。\n\n```tsx\n<Calendar visible={false} type=\"daterange\" title=\"选择入住日期\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `CalendarValue` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| type | 类型 | `CalendarType` | `'date'` |\n| minDate | 最小可选择日期 | `number` | — |\n| maxDate | 最大可选择日期 | `number` | — |\n| formatter | 内容格式化函数 | `(day: CalendarDayItem) => Partial<CalendarDayItem>` | — |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | — |\n| firstDayOfWeek | 每周起始日期,0 表示星期日 | `number` | — |\n| defaultTime | 未指定时分秒时使用的默认时间 | `string \\| readonly string[]` | — |\n| maxRange | 允许选择的最大范围 | `number` | — |\n| allowSameDay | 是否允许范围起止日期相同 | `boolean` | — |\n| panelHeight | 面板高度 | `number` | — |\n| showPanelTitle | 是否显示面板标题 | `boolean` | — |\n| switchMode | 日历切换方式 | `CalendarSwitchMode` | — |\n| rangePrompt | 日期范围选择提示文字 | `string` | — |\n| timeFilter | 时间选项过滤函数 | `DatetimeFilter` | — |\n| timeItemHeight | 时间滚轮行高 | `number` | — |\n| timeVisibleItemCount | 时间滚轮可见行数 | `number` | — |\n| hideSecond | 是否隐藏秒选项 | `boolean` | — |\n| visible | 是否显示选择面板 | `boolean` | — |\n| title | 标题内容 | `string` | `'选择日期'` |\n| confirmText | 确认文案 | `string` | `'确定'` |\n| showConfirm | 是否显示确认按钮 | `boolean` | `true` |\n| beforeConfirm | 确认前校验 | `(value: CalendarValue) => boolean \\| Promise<boolean>` | — |\n| innerDisplayFormat | 选择器内部显示格式 | `(value: number \\| null, endpoint: 'start' \\| 'end', type: CalendarType) => string` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | `false` |\n| showTypeSwitch | 是否展示日期类型切换 | `boolean` | `false` |\n| shortcuts | 快捷选项列表 | `readonly CalendarShortcut[]` | `[]` |\n| confirmLeft | confirmLeft 配置 | `ReactNode` | — |\n| confirmRight | confirmRight 配置 | `ReactNode` | — |\n| viewClassName | 选择面板类名 | `string` | `''` |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| duration | 动画或显示时长,单位 ms | `number` | `200` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `true` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n| zIndex | 浮层层级 | `number` | `100` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n| onOverRange | 对应操作发生时触发 | () => void |\n| onVisibleChange | 面板显示状态变化时触发 | (visible: boolean) => void |\n| onConfirm | 确认选择时触发 | (event: { value: CalendarValue; type: CalendarType }) => void |\n| onChange | 值发生变化时触发 | (event: { value: CalendarValue }) => void |\n| onPickChange | 对应操作发生时触发 | (event: { value: CalendarValue }) => void |\n| onCancel | 取消操作时触发 | () => void |\n| onOpen | 打开时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n| onShortcutsClick | 对应操作发生时触发 | (event: { item: CalendarShortcut; index: number }) => CalendarValue \\| Promise<CalendarValue> |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| confirmLeft | 自定义区域内容 | ReactNode |\n| confirmRight | 自定义区域内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type CalendarValue = number | readonly (number | null)[] | null;\n\nexport type CalendarType =\n | 'date'\n | 'dates'\n | 'daterange'\n | 'datetime'\n | 'datetimerange'\n | 'week'\n | 'weekrange'\n | 'month'\n | 'monthrange';\n\nexport type CalendarDayItem = {\n date: number;\n text: string;\n disabled: boolean;\n type: CalendarDayType;\n topInfo?: string;\n bottomInfo?: string;\n customClass?: string;\n};\n\nexport type CalendarSwitchMode = 'none' | 'month' | 'year-month';\n\nexport type CalendarShortcut = { text: string; [key: string]: unknown };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-calendar-range-bg` | 当前组件 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-on-primary` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n| `--cso-ui-text-secondary` | 共享主题 |\n\n## 源代码\n\n[Calendar 组件源码](./sources/calendar/Calendar.tsx.txt) · [示例源码](./sources/calendar/demo.tsx.txt) · [文档源码](./sources/calendar/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Calendar, Cell, CellGroup, Toast, useToast } from 'daisu-ui';\nimport type { CalendarShortcut, CalendarSwitchMode, CalendarType, CalendarValue } from 'daisu-ui';\nimport { calendarValues, calendarWeekNumber } from 'daisu-ui/utils';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { calendarFormatter, CalendarSwitch } from './calendarShared.js';\nconst pad = (value: number) => String(value).padStart(2, '0');\nconst typeFor = (key: string): CalendarType => ({ multiple: 'dates', range: 'daterange', datetime: 'datetime', datetimerange: 'datetimerange', week: 'week', month: 'month', weekrange: 'weekrange', monthrange: 'monthrange', format: 'daterange', display: 'daterange', shortcuts: 'daterange' } as Record<string, CalendarType>)[key] ?? 'date';\nfunction label(value: CalendarValue | undefined, type: CalendarType, custom = false): string {\n const values = calendarValues(value), formatted = values.map(value => {\n const date = new Date(value), day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n return custom ? `${pad(date.getFullYear() % 100)}年${pad(date.getMonth() + 1)}月${pad(date.getDate())}日` : type.startsWith('week') ? `${date.getFullYear()} 第${pad(calendarWeekNumber(value))}周` : type.startsWith('month') ? day.slice(0, 7) : type.startsWith('datetime') ? `${day} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` : day;\n });\n return type.endsWith('range') ? formatted.length ? formatted.join(' - ') : '-' : formatted.join(', ');\n}\nconst shortcuts: CalendarShortcut[] = [7, 15, 30].map(id => ({ text: `近${id}天`, id }));\nconst shortcutValue = ({ item }: { item: CalendarShortcut }) => { 'background only'; const end = Date.now() - 86400000; return [end - Number(item.id) * 86400000, end]; };\nconst displayFormat = (value: number | null, endpoint: 'start' | 'end') => value === null ? endpoint === 'start' ? '活动开始时间' : '活动结束时间' : label(value, 'date', true);\nexport function CalendarExample() {\n const [now] = useState(() => Date.now()), [opened, setOpened] = useState(''), [switchMode, setSwitchMode] = useState<CalendarSwitchMode>('none');\n const [values, setValues] = useState<Record<string, CalendarValue>>(() => { const now = Date.now(), day = 86400000; return { basic: now, multiple: [now - 3 * day, now], range: [], datetime: now, datetimerange: [now - 3 * day, now - day], week: now, month: now, weekrange: [now - 14 * day, now], monthrange: [now - 33 * day, now], quick: now, before: null, types: now, format: [now - 3 * day, now], display: [now - 3 * day, now], shortcuts: [], footer: now }; });\n const toast = useToast();\n const beforeConfirm = (value: CalendarValue) => { 'background only'; const allow = typeof value === 'number' && value <= Date.now(); if (!allow) toast.error({ msg: '该日期暂无数据', zIndex: 110 }); return allow; };\n const row = (key: string, title: string) => <CellGroup key={key} border><Cell title={title} value={label(values[key], typeFor(key), key === 'display')} arrow onTap={() => setOpened(key)} /></CellGroup>;\n const min = new Date(now); min.setFullYear(min.getFullYear() - 20); min.setMonth(min.getMonth() - 6); min.setHours(0, 0, 0, 0);\n return <view className=\"demo-calendar-page\">\n <DemoGroup title=\"组件类型\">{row('basic', '单个日期选择')}{row('multiple', '多个日期选择')}{row('range', '日期范围选择')}{row('datetime', '日期时间选择')}{row('datetimerange', '日期时间范围选择')}{row('week', '周选择')}{row('month', '月选择')}{row('weekrange', '周范围选择')}{row('monthrange', '月范围选择')}</DemoGroup>\n <DemoGroup title=\"组件状态\">{row('quick', '快捷操作')}{row('before', 'before-confirm')}</DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"切换模式\"><CalendarSwitch value={switchMode} onChange={setSwitchMode} /></ExampleBlock>{row('types', '日周月切换')}</DemoGroup>\n <DemoGroup title=\"组件样式\">{row('format', '日期格式化')}{row('display', '自定义展示')}</DemoGroup>\n <DemoGroup title=\"特殊样式\">{row('shortcuts', '快捷选项')}{row('footer', '拓展确定区域')}</DemoGroup>\n {Object.keys(values).map(key => <Calendar key={key} visible={opened === key} value={values[key]} type={typeFor(key)} switchMode={switchMode} minDate={key === 'month' ? min.getTime() : undefined} firstDayOfWeek={key === 'weekrange' || key === 'types' ? 1 : 0} showConfirm={key !== 'quick'} showTypeSwitch={key === 'types'} beforeConfirm={key === 'before' ? beforeConfirm : undefined} formatter={key === 'format' ? calendarFormatter : undefined} innerDisplayFormat={key === 'display' ? displayFormat : undefined} shortcuts={key === 'shortcuts' ? shortcuts : undefined} onShortcutsClick={key === 'shortcuts' ? shortcutValue : undefined} confirmRight={key === 'footer' ? <Button block label=\"选择今天\" className=\"demo-calendar-today\" onTap={() => { 'background only'; const date = new Date(); date.setHours(0, 0, 0, 0); setValues(previous => ({ ...previous, footer: date.getTime() })); }} /> : undefined} onVisibleChange={show => { 'background only'; if (!show) setOpened(''); }} onConfirm={({ value }) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); }} />)}\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"type","type":"CalendarType","optional":true,"description":"类型","defaultValue":"'date'","values":["date","datetime","dates","daterange","datetimerange","week","weekrange","month","monthrange"]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"value","type":"CalendarValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","values":[false,true]},{"name":"minDate","type":"number","optional":true,"description":"最小可选择日期"},{"name":"maxDate","type":"number","optional":true,"description":"最大可选择日期"},{"name":"formatter","type":"(day: CalendarDayItem) => Partial<CalendarDayItem>","optional":true,"description":"内容格式化函数"},{"name":"firstDayOfWeek","type":"number","optional":true,"description":"每周起始日期,0 表示星期日"},{"name":"defaultTime","type":"string | readonly string[]","optional":true,"description":"未指定时分秒时使用的默认时间"},{"name":"maxRange","type":"number","optional":true,"description":"允许选择的最大范围"},{"name":"allowSameDay","type":"boolean","optional":true,"description":"是否允许范围起止日期相同","values":[false,true]},{"name":"panelHeight","type":"number","optional":true,"description":"面板高度"},{"name":"showPanelTitle","type":"boolean","optional":true,"description":"是否显示面板标题","values":[false,true]},{"name":"switchMode","type":"CalendarSwitchMode","optional":true,"description":"日历切换方式","values":["none","year-month","month"]},{"name":"rangePrompt","type":"string","optional":true,"description":"日期范围选择提示文字"},{"name":"timeFilter","type":"DatetimeFilter","optional":true,"description":"时间选项过滤函数"},{"name":"timeItemHeight","type":"number","optional":true,"description":"时间滚轮行高"},{"name":"timeVisibleItemCount","type":"number","optional":true,"description":"时间滚轮可见行数"},{"name":"hideSecond","type":"boolean","optional":true,"description":"是否隐藏秒选项","values":[false,true]},{"name":"visible","type":"boolean","optional":true,"description":"是否显示选择面板","values":[false,true]},{"name":"title","type":"string","optional":true,"description":"标题内容","defaultValue":"'选择日期'"},{"name":"confirmText","type":"string","optional":true,"description":"确认文案","defaultValue":"'确定'"},{"name":"showConfirm","type":"boolean","optional":true,"description":"是否显示确认按钮","defaultValue":"true","values":[false,true]},{"name":"beforeConfirm","type":"(value: CalendarValue) => boolean | Promise<boolean>","optional":true,"description":"确认前校验"},{"name":"innerDisplayFormat","type":"(value: number | null, endpoint: 'start' | 'end', type: CalendarType) => string","optional":true,"description":"选择器内部显示格式","defaultValue":"innerLabel"},{"name":"ellipsis","type":"boolean","optional":true,"description":"是否截断超出范围的文字","defaultValue":"false","values":[false,true]},{"name":"showTypeSwitch","type":"boolean","optional":true,"description":"是否展示日期类型切换","defaultValue":"false","values":[false,true]},{"name":"shortcuts","type":"readonly CalendarShortcut[]","optional":true,"description":"快捷选项列表","defaultValue":"[]"},{"name":"confirmLeft","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"confirmRight","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"viewClassName","type":"string","optional":true,"description":"选择面板类名","defaultValue":"''"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"200"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"100"}],"events":[{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onOverRange","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"面板显示状态变化时触发"},{"name":"onConfirm","type":"(event: { value: CalendarValue; type: CalendarType }) => void","optional":true,"description":"确认选择时触发"},{"name":"onChange","type":"(event: { value: CalendarValue }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPickChange","type":"(event: { value: CalendarValue }) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消操作时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onShortcutsClick","type":"(event: { item: CalendarShortcut; index: number }) => CalendarValue | Promise<CalendarValue>","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"confirmLeft","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"confirmRight","type":"ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-calendar-range-bg","defaultValue":"#202127","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-on-primary","defaultValue":"#fff","description":"共享语义主题变量","darkValue":"#16110d"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-secondary","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","弹层日历"],"title":"弹层日历","section":"组件类型","description":"通过 `visible` 控制日历弹层,`type=\"date\"` 使用单日模式,`onConfirm` 返回选择的日期。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择日期\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Calendar\n visible={visible}\n onVisibleChange={setVisible}\n type=\"date\"\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择日期\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Calendar\n visible={visible}\n onVisibleChange={setVisible}\n type=\"date\"\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","日期范围"],"title":"日期范围","section":"组件变体","description":"设置 `type=\"daterange\"` 选择日期范围,通过 `title` 设置面板标题。","language":"tsx","code":"<Calendar visible={false} type=\"daterange\" title=\"选择入住日期\" />\n","blocks":[{"language":"tsx","code":"<Calendar visible={false} type=\"daterange\" title=\"选择入住日期\" />\n"}]}],"allowUnknownProps":false},{"name":"calendarValues","id":"calendar-values","label":"calendarValues","category":"公共 API","categoryId":"api","kind":"utility","description":"calendarValues 公开 API","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/calendarModel.ts","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"CalendarView","id":"calendar-view","label":"CalendarView 日历面板","category":"录入","categoryId":"form","kind":"component","description":"日历面板在页面中直接展示月份与日期,支持单日、范围以及日期禁用。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/CalendarView.tsx","docPath":"docs/ui/components/calendar-view.md","doc":"# CalendarView 日历面板\n\n日历面板在页面中直接展示月份与日期,支持单日、范围以及日期禁用。\n\n```tsx\nimport { CalendarView } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 单日选择\n\n设置 `type=\"date\"` 使用单日模式,`value` 指定日期,`onChange` 获取选择结果。\n\n```tsx\n<CalendarView\n value={Date.now()}\n type=\"date\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件变体\n\n### 日期范围\n\n设置 `type=\"daterange\"` 选择开始日期和结束日期。\n\n```tsx\n<CalendarView type=\"daterange\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `CalendarType` | `'date'` |\n| minDate | 最小可选择日期 | `number` | — |\n| maxDate | 最大可选择日期 | `number` | — |\n| firstDayOfWeek | 每周起始日期,0 表示星期日 | `number` | `0` |\n| defaultTime | 未指定时分秒时使用的默认时间 | `string \\| readonly string[]` | — |\n| maxRange | 允许选择的最大范围 | `number` | — |\n| allowSameDay | 是否允许范围起止日期相同 | `boolean` | `false` |\n| value | 当前值;传入后由调用方更新 | `CalendarValue` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| panelHeight | 面板高度 | `number` | `316` |\n| showPanelTitle | 是否显示面板标题 | `boolean` | `true` |\n| switchMode | 日历切换方式 | `CalendarSwitchMode` | `'none'` |\n| rangePrompt | 日期范围选择提示文字 | `string` | — |\n| formatter | 内容格式化函数 | `(day: CalendarDayItem) => Partial<CalendarDayItem>` | — |\n| timeFilter | 时间选项过滤函数 | `DatetimeFilter` | — |\n| timeItemHeight | 时间滚轮行高 | `number` | `44` |\n| timeVisibleItemCount | 时间滚轮可见行数 | `number` | `3` |\n| hideSecond | 是否隐藏秒选项 | `boolean` | `false` |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: CalendarValue }) => void |\n| onOverRange | 对应操作发生时触发 | () => void |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| scrollIntoView | 调用实例方法 | () => void |\n| getSelected | 调用实例方法 | () => CalendarValue |\n\n## 数据类型\n\n```tsx\nexport type CalendarType =\n | 'date'\n | 'dates'\n | 'daterange'\n | 'datetime'\n | 'datetimerange'\n | 'week'\n | 'weekrange'\n | 'month'\n | 'monthrange';\n\nexport type CalendarValue = number | readonly (number | null)[] | null;\n\nexport type CalendarSwitchMode = 'none' | 'month' | 'year-month';\n\nexport type CalendarDayItem = {\n date: number;\n text: string;\n disabled: boolean;\n type: CalendarDayType;\n topInfo?: string;\n bottomInfo?: string;\n customClass?: string;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[CalendarView 组件源码](./sources/calendar-view/CalendarView.tsx.txt) · [示例源码](./sources/calendar-view/demo.tsx.txt) · [文档源码](./sources/calendar-view/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { CalendarView, Radio, RadioGroup } from 'daisu-ui';\nimport type { CalendarType, CalendarValue, CalendarSwitchMode } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { calendarFormatter, CalendarSwitch } from './calendarShared.js';\nexport function CalendarViewExample() {\n const [values, setValues] = useState<Record<string, CalendarValue>>(() => { const now = Date.now(), day = 86400000; return { single: now, multiple: null, range: [now - 33 * day, now], datetime: now, datetimerange: [now - 3 * day, now - day], format: [now - 3 * day, now - day], first: [now - 3 * day, now - day], limit: [now - 3 * day, now - day] }; });\n const [singleType, setSingleType] = useState<CalendarType>('date'), [rangeType, setRangeType] = useState<CalendarType>('daterange'), [switchMode, setSwitchMode] = useState<CalendarSwitchMode>('none');\n const change = (key: string, value: CalendarValue) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); };\n const view = (key: string, type: CalendarType = 'date') => <CalendarView value={values[key]} type={type} switchMode={switchMode} allowSameDay firstDayOfWeek={key === 'first' ? 1 : 0} formatter={key === 'format' ? calendarFormatter : undefined} maxRange={key === 'limit' ? 3 : undefined} onChange={({ value }) => change(key, value)} />;\n const types = (current: CalendarType, options: CalendarType[], onChange: (type: CalendarType) => void) => <view className=\"demo-calendar-types\"><text>切换类型:</text><RadioGroup<CalendarType> type=\"button\" value={current} onChange={next => { 'background only'; if (next) onChange(next); }}>{options.map(type => <Radio key={type} value={type}>{type}</Radio>)}</RadioGroup></view>;\n return <view className=\"demo-calendar-view-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"单个日期选择\" noPadding>{types(singleType, ['date', 'week', 'month'], setSingleType)}{view('single', singleType)}</ExampleBlock>\n <ExampleBlock title=\"多个日期选择\" noPadding>{view('multiple', 'dates')}</ExampleBlock>\n <ExampleBlock title=\"日期范围选择\" noPadding>{types(rangeType, ['daterange', 'weekrange', 'monthrange'], setRangeType)}{view('range', rangeType)}</ExampleBlock>\n <ExampleBlock title=\"时间类型\" noPadding>{view('datetime', 'datetime')}</ExampleBlock>\n <ExampleBlock title=\"时间范围类型\" noPadding>{view('datetimerange', 'datetimerange')}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"范围选择允许选中同一日期\" noPadding>{view('range', 'daterange')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"切换模式\"><CalendarSwitch value={switchMode} onChange={setSwitchMode} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义日期\" noPadding>{view('format', 'daterange')}</ExampleBlock><ExampleBlock title=\"设置周起始日\" noPadding>{view('first')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"限制最大选择范围\" noPadding>{view('limit', 'daterange')}</ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"type","type":"CalendarType","optional":true,"description":"类型","defaultValue":"'date'","values":["date","datetime","dates","daterange","datetimerange","week","weekrange","month","monthrange"]},{"name":"minDate","type":"number","optional":true,"description":"最小可选择日期"},{"name":"maxDate","type":"number","optional":true,"description":"最大可选择日期"},{"name":"firstDayOfWeek","type":"number","optional":true,"description":"每周起始日期,0 表示星期日","defaultValue":"0"},{"name":"defaultTime","type":"string | readonly string[]","optional":true,"description":"未指定时分秒时使用的默认时间"},{"name":"maxRange","type":"number","optional":true,"description":"允许选择的最大范围"},{"name":"allowSameDay","type":"boolean","optional":true,"description":"是否允许范围起止日期相同","defaultValue":"false","values":[false,true]},{"name":"value","type":"CalendarValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"panelHeight","type":"number","optional":true,"description":"面板高度","defaultValue":"316"},{"name":"showPanelTitle","type":"boolean","optional":true,"description":"是否显示面板标题","defaultValue":"true","values":[false,true]},{"name":"switchMode","type":"CalendarSwitchMode","optional":true,"description":"日历切换方式","defaultValue":"'none'","values":["none","year-month","month"]},{"name":"rangePrompt","type":"string","optional":true,"description":"日期范围选择提示文字"},{"name":"formatter","type":"(day: CalendarDayItem) => Partial<CalendarDayItem>","optional":true,"description":"内容格式化函数"},{"name":"timeFilter","type":"DatetimeFilter","optional":true,"description":"时间选项过滤函数"},{"name":"timeItemHeight","type":"number","optional":true,"description":"时间滚轮行高","defaultValue":"44"},{"name":"timeVisibleItemCount","type":"number","optional":true,"description":"时间滚轮可见行数","defaultValue":"3"},{"name":"hideSecond","type":"boolean","optional":true,"description":"是否隐藏秒选项","defaultValue":"false","values":[false,true]},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: CalendarValue }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onOverRange","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"scrollIntoView","description":"调用实例方法","type":"() => void"},{"name":"getSelected","description":"调用实例方法","type":"() => CalendarValue"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","单日选择"],"title":"单日选择","section":"组件类型","description":"设置 `type=\"date\"` 使用单日模式,`value` 指定日期,`onChange` 获取选择结果。","language":"tsx","code":"<CalendarView\n value={Date.now()}\n type=\"date\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<CalendarView\n value={Date.now()}\n type=\"date\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","日期范围"],"title":"日期范围","section":"组件变体","description":"设置 `type=\"daterange\"` 选择开始日期和结束日期。","language":"tsx","code":"<CalendarView type=\"daterange\" />\n","blocks":[{"language":"tsx","code":"<CalendarView type=\"daterange\" />\n"}]}],"allowUnknownProps":false},{"name":"calendarWeekNumber","id":"calendar-week-number","label":"calendarWeekNumber","category":"公共 API","categoryId":"api","kind":"utility","description":"calendarWeekNumber 公开 API","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/calendarModel.ts","doc":"","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of an object."},{"name":"toFixed","type":"string","optional":false,"description":"Returns a string representing a number in fixed-point notation."},{"name":"toExponential","type":"string","optional":false,"description":"Returns a string containing a number represented in exponential notation."},{"name":"toPrecision","type":"string","optional":false,"description":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."},{"name":"valueOf","type":"number","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"toLocaleString","type":"string","optional":false,"description":"Converts a number to a string by using the current or specified locale."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Card","id":"card","label":"Card 卡片","category":"基础","categoryId":"basic","kind":"component","description":"卡片用于聚合标题、正文与底部操作。标准卡片适合独立内容块,矩形卡片适合连续列表。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Card.tsx","docPath":"docs/ui/components/card.md","doc":"# Card 卡片\n\n卡片用于聚合标题、正文与底部操作。标准卡片适合独立内容块,矩形卡片适合连续列表。\n\n```tsx\nimport { Card } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 标准卡片\n\n设置 `variant=\"standard\"` 使用标准卡片,通过 `title` 设置标题。\n\n```tsx\n<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n```\n\n### 矩形卡片\n\n设置 `type=\"rectangle\"` 使用矩形卡片,适合连续排列的内容区域。\n\n```tsx\n<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n```\n\n## 内容形态\n\n### 自定义标题与操作\n\n通过 `title` 自定义标题节点,通过 `footer` 设置底部操作,子节点作为正文内容。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode | `ReactNode` | — |\n| description | 兼容原业务说明,standard也可使用 | `string` | — |\n| children | 卡片内容,原始字符串/数字自动包text;standard始终保留内容容器 | `ReactNode` | — |\n| footer | 底部ReactNode;未提供/false不渲染,0有效 | `ReactNode` | — |\n| variant | business保留既有样式;standard使用标准样式 | `'business' \\| 'standard'` | — |\n| type | rectangle:矩形、无横边距和阴影;未传variant时自动选standard | `'rectangle'` | — |\n| customTitleClass | 三个区域的类名 | `string` | `''` |\n| customContentClass | 三个区域的类名 | `string` | `''` |\n| customFooterClass | 三个区域的类名 | `string` | `''` |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode | ReactNode |\n| children | 卡片内容,原始字符串/数字自动包text;standard始终保留内容容器 | ReactNode |\n| footer | 底部ReactNode;未提供/false不渲染,0有效 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Card 组件源码](./sources/card/Card.tsx.txt) · [示例源码](./sources/card/demo.tsx.txt) · [文档源码](./sources/card/docs.md.txt)\n","demoSource":"import { Button, Card, Dialog, Icon, Toast, useDialog, useToast } from 'daisu-ui';\nimport type { ReactNode } from '@lynx-js/react';\nimport cat from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst passage='至若春和景明,波澜不惊,上下天光,一碧万顷,沙鸥翔集,锦鳞游泳,岸芷汀兰,郁郁青青。而或长烟一空,皓月千里,浮光跃金,静影沉璧,渔歌互答,此乐何极!登斯楼也,则有心旷神怡,宠辱偕忘,把酒临风,其喜洋洋者矣。';\nfunction CardList({items}:{items:[string,string][]}){return <view className=\"demo-card-list\">{items.map(([title,description])=><view className=\"demo-card-list-item\" key={title}><image className=\"demo-card-list-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-list-copy\"><text className=\"demo-card-list-title\">{title}</text><text className=\"demo-card-description\">{description}</text></view></view>)}</view>;}\nfunction CardTitle({title,tip,icon}:{title:string;tip:string;icon:string}){return <view className=\"demo-card-custom-title\"><text>{title}</text><view className=\"demo-card-title-tip\"><Icon name={icon} size={14} color=\"#868a9c\"/><text>{tip}</text></view></view>;}\nexport function CardExample(){\n const toast=useToast(),dialog=useDialog();\n const actions=(labels:string[]):ReactNode=><view className=\"demo-card-actions\">{labels.map(label=><Button key={label} size=\"small\" variant=\"plain\" label={label} onTap={()=>{ 'background only'; if(label==='阅读全文')void dialog.alert({title:'岳阳楼记',msg:passage});else toast.success(`${label}成功`); }}/>)}</view>;\n return <view className=\"demo-card-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock noPadding title=\"基本使用\">\n <Card variant=\"standard\" title=\"岳阳楼记\" footer={actions(['阅读全文'])}><text className=\"demo-card-passage\">{passage}</text></Card>\n <Card variant=\"standard\" title=\"个人名片\" footer={actions(['关注'])}><view className=\"demo-card-user\"><image className=\"demo-card-user-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-user-copy\"><text className=\"demo-card-user-title\">小黑猫的故事</text><text className=\"demo-card-description\">一只温柔的黑色小猫,喜欢在午后的阳光下打滚,追逐蝴蝶。</text><text className=\"demo-card-meta\">粉丝 12.5w</text></view></view></Card>\n </ExampleBlock><ExampleBlock noPadding title=\"矩形卡片\"><Card type=\"rectangle\" title=\"生活记录\" footer={actions(['点赞','评论'])}><CardList items={[[\"今天天气真好\",\"2026年2月11日 晴天 22℃\"],[\"慵懒的午睡时光\",\"阳光洒进房间,舒服得不想动\"]]}/></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock noPadding title=\"复杂卡片\"><Card variant=\"standard\" title=\"宠物档案\" footer={actions(['点赞 (1.2w)','收藏','分享'])}><view className=\"demo-card-info\"><view className=\"demo-card-info-image-box\"><image className=\"demo-card-info-image\" src={cat} mode=\"aspectFill\"/><text className=\"demo-card-info-badge\">人气之星</text></view><view className=\"demo-card-info-copy\"><text className=\"demo-card-info-title\">小黑:治愈系黑色小猫咪</text><view className=\"demo-card-info-meta\"><text className=\"demo-card-info-tag\">萌宠日常</text><text className=\"demo-card-info-time\">2小时前发布</text></view><view className=\"demo-card-props\">{[[['品种','中华田园猫'],['性格','活泼好动'],['特技','高能跳跃']],[['年龄','0.5岁'],['性别','女'],['坐标','上海']]].map((column,index)=><view key={index} className=\"demo-card-prop-col\">{column.map(([label,value])=><view key={label} className=\"demo-card-prop\"><text className=\"demo-card-prop-label\">{label}</text><text className=\"demo-card-prop-value\">{value}</text></view>)}</view>)}</view></view></view></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock noPadding title=\"自定义标题\"><Card type=\"rectangle\" title={<CardTitle title=\"兴趣爱好\" tip=\"快乐源泉\" icon=\"heart\"/>} footer={actions(['点赞','分享'])}><CardList items={[[\"窗边的午睡\",\"最喜欢在温暖的阳光下打盹\"],[\"毛线球游戏\",\"追逐毛线球时最专注最可爱\"]]}/></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock noPadding title=\"去除 Footer\"><Card type=\"rectangle\" title=\"精彩瞬间\"><view className=\"demo-card-moment\"><image className=\"demo-card-user-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-moment-copy\"><text className=\"demo-card-moment-title\">午后阳光下的惬意时光</text><text className=\"demo-card-description\">今天的天气真好,阳光洒在身上暖洋洋的。小黑在窗台上睡得正香,偶尔动动耳朵,大概是梦见了好吃的鱼罐头吧。</text><text className=\"demo-card-meta\">阅读 3.5w</text></view></view></Card><Card type=\"rectangle\" title={<CardTitle title=\"更多动态\" tip=\"每日更新\" icon=\"warning\"/>}><CardList items={[[\"翻肚皮打滚特技\",\"超级可爱的示范表演,萌化你的心\"],[\"高空跳跃绝技\",\"展现猫咪的灵活身手,惊叹连连\"]]}/></Card></ExampleBlock></DemoGroup>\n <Dialog {...dialog.props}/><Toast {...toast.props}/>\n </view>;\n}\n","props":[{"name":"title","type":"ReactNode","optional":true,"description":"ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode"},{"name":"description","type":"string","optional":true,"description":"兼容原业务说明,standard也可使用"},{"name":"footer","type":"ReactNode","optional":true,"description":"底部ReactNode;未提供/false不渲染,0有效"},{"name":"variant","type":"'business' | 'standard'","optional":true,"description":"business保留既有样式;standard使用标准样式","values":["business","standard"]},{"name":"type","type":"'rectangle'","optional":true,"description":"rectangle:矩形、无横边距和阴影;未传variant时自动选standard","values":["rectangle"]},{"name":"customTitleClass","type":"string","optional":true,"description":"三个区域的类名","defaultValue":"''"},{"name":"customContentClass","type":"string","optional":true,"description":"三个区域的类名","defaultValue":"''"},{"name":"customFooterClass","type":"string","optional":true,"description":"三个区域的类名","defaultValue":"''"},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode"},{"name":"children","type":"ReactNode","optional":true,"description":"卡片内容,原始字符串/数字自动包text;standard始终保留内容容器"},{"name":"footer","type":"ReactNode","optional":true,"description":"底部ReactNode;未提供/false不渲染,0有效"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","标准卡片"],"title":"标准卡片","section":"组件类型","description":"设置 `variant=\"standard\"` 使用标准卡片,通过 `title` 设置标题。","language":"tsx","code":"<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n","blocks":[{"language":"tsx","code":"<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n"}]},{"name":"demo-2","aliases":["demo-2","矩形卡片"],"title":"矩形卡片","section":"组件类型","description":"设置 `type=\"rectangle\"` 使用矩形卡片,适合连续排列的内容区域。","language":"tsx","code":"<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n","blocks":[{"language":"tsx","code":"<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义标题与操作"],"title":"自定义标题与操作","section":"内容形态","description":"通过 `title` 自定义标题节点,通过 `footer` 设置底部操作,子节点作为正文内容。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n"}]}],"allowUnknownProps":false},{"name":"Cascader","id":"cascader","label":"Cascader 级联选择","category":"录入","categoryId":"form","kind":"component","description":"级联选择器适合省市区、分类等层级数据,支持逐级选择和异步加载。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Cascader.tsx","docPath":"docs/ui/components/cascader.md","doc":"# Cascader 级联选择\n\n级联选择器适合省市区、分类等层级数据,支持逐级选择和异步加载。\n\n```tsx\nimport { Cascader } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 层级选择\n\n通过 `options` 配置层级数据,子级放在 `children` 中,`visible` 控制面板显示。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择地区\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Cascader\n visible={visible}\n onVisibleChange={setVisible}\n options={[\n {\n value: 'zj',\n label: '浙江',\n children: [{ value: 'hz', label: '杭州' }],\n },\n ]}\n/>\n```\n\n## 组件样式\n\n### 自定义标题\n\n通过 `title` 设置级联面板标题。\n\n```tsx\n<Cascader\n visible={false}\n title=\"选择分类\"\n options={[{ value: 'book', label: '图书' }]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| valueKey | 选项值字段名 | `string` | — |\n| textKey | 文字字段名 | `string` | — |\n| childrenKey | 子节点字段名 | `string` | — |\n| tipKey | 选项说明字段名 | `string` | — |\n| isLeafKey | 叶子节点字段名 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `CascaderValue` | — |\n| options | 选项配置 | `readonly CascaderInput[]` | — |\n| visible | 是否显示选择面板 | `boolean` | — |\n| title | 标题内容 | `string` | `'请选择'` |\n| placeholder | 占位内容或输入提示 | `string` | `'请选择'` |\n| checkStrictly | 是否允许选择中间层级 | `boolean` | `false` |\n| confirmText | 确认文案 | `string` | `'确认'` |\n| lazyLoad | 异步加载下一级数据 | `CascaderLazyLoad` | — |\n| beforeConfirm | 确认前校验 | `(value: CascaderScalar, options: CascaderOption[]) => boolean \\| Promise<boolean>` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | `false` |\n| loadingColor | 加载指示器颜色 | `string` | `'#4D80F0'` |\n| lineTheme | 标签指示线外观 | `TabsLineTheme` | — |\n| lineWidth | 指示线宽度 | `number \\| string` | — |\n| lineHeight | 行高或指示线高度 | `number \\| string` | — |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `true` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n| zIndex | 浮层层级 | `number` | `100` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onVisibleChange | 面板显示状态变化时触发 | (visible: boolean) => void |\n| onChange | 值发生变化时触发 | (event: CascaderSelection) => void |\n| onConfirm | 确认选择时触发 | (event: CascaderSelection) => void |\n| onClose | 关闭时触发 | () => void |\n| onCancel | 取消操作时触发 | () => void |\n| onOpen | 打开时触发 | () => void |\n| onLoadError | 对应操作发生时触发 | (error: unknown) => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type CascaderValue = CascaderScalar | readonly CascaderScalar[];\n\nexport type CascaderLazyLoad = (\n option: CascaderOption | null,\n tabIndex: number,\n resolve: (options: readonly CascaderInput[]) => void,\n) => void | Promise<void>;\n\nexport type CascaderOption = {\n value: CascaderScalar;\n text: string;\n children?: readonly CascaderOption[];\n disabled?: boolean;\n tip?: string;\n isLeaf?: boolean;\n [key: string]: unknown;\n};\n\nexport type CascaderSelection = {\n value: CascaderValue;\n selectedOptions: CascaderOption[];\n};\n\nexport type TabsLineTheme = 'normal' | 'text' | 'underline' | 'dot';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Cascader 组件源码](./sources/cascader/Cascader.tsx.txt) · [示例源码](./sources/cascader/demo.tsx.txt) · [文档源码](./sources/cascader/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Cascader, Cell, CellGroup, Toast, useToast } from 'daisu-ui';\nimport type { CascaderOption, CascaderValue, CascaderLazyLoad } from 'daisu-ui';\nimport { getDemoAreaOptions } from '../areaOptions.js';\nimport { DemoGroup } from './shared.js';\nconst custom = [{ id: 1, name: '选项一', items: [{ id: 11, name: '选项一-一' }, { id: 12, name: '选项一-二' }] }, { id: 2, name: '选项二', items: [{ id: 21, name: '选项二-一' }, { id: 22, name: '选项二-二' }] }];\nconst remoteAreas: Record<string, [string, string][]> = {\n root: [['110000', '北京市'], ['130000', '河北省'], ['440000', '广东省']], '110000': [['110100', '北京市辖区']], '130000': [['130100', '石家庄市'], ['130200', '唐山市']], '440000': [['440100', '广州市'], ['440300', '深圳市']],\n '110100': [['110101', '东城区'], ['110102', '西城区']], '130100': [['130102', '长安区'], ['130104', '桥西区']], '130200': [['130202', '路南区'], ['130204', '古冶区']], '440100': [['440103', '荔湾区'], ['440104', '越秀区']], '440300': [['440303', '罗湖区'], ['440304', '福田区']],\n};\nconst jobs: Record<string, [string, string][]> = {\n root: [['it', 'IT互联网'], ['finance', '金融'], ['healthcare', '医疗健康']], it: [['it-dev', '软件开发'], ['it-ops', '运维']], 'it-dev': [['fe', '前端开发'], ['be', '后端开发']], 'it-ops': [['devops', 'DevOps'], ['admin', '系统管理员']], finance: [['finance-bank', '银行'], ['finance-insurance', '保险']], 'finance-bank': [['teller', '柜员'], ['manager', '经理']], 'finance-insurance': [['agent', '代理人'], ['adjuster', '理赔员']], healthcare: [['health-hospital', '医院'], ['health-pharma', '制药']], 'health-hospital': [['doctor', '医生'], ['nurse', '护士']], 'health-pharma': [['researcher', '研究员'], ['production', '生产员']],\n};\nconst initial: Record<string, CascaderValue> = { basic: '', initial: '150121', custom: 1, disabled: '', tip: '', validate: '', format: '130204', title: '', lazy: ['130000', '130200', '130204'], jobs: '', strict: '' };\nconst defaultLabels = { initial: '内蒙古自治区/呼和浩特市/土默特左旗', custom: '选项一/选项一-一', format: '唐山市-古冶区', lazy: '河北省/唐山市/古冶区' };\nexport function CascaderExample() {\n const [opened, setOpened] = useState(''), [values, setValues] = useState(initial), [labels, setLabels] = useState<Record<string, string>>(defaultLabels), [areas, setAreas] = useState<readonly CascaderOption[]>([]), [disabledAreas, setDisabledAreas] = useState<readonly CascaderOption[]>([]), [tipAreas, setTipAreas] = useState<readonly CascaderOption[]>([]);\n const toast = useToast(), timers = useRef(new Set<ReturnType<typeof setTimeout>>());\n useEffect(() => () => { timers.current.forEach(clearTimeout); }, []);\n const loaders = useRef<Record<string, CascaderLazyLoad>>({});\n useEffect(() => {\n for (const [key, tree] of Object.entries({ lazy: remoteAreas, jobs })) loaders.current[key] = (option, _index, resolve) => {\n 'background only'; const timer = setTimeout(() => { timers.current.delete(timer); resolve((tree[String(option?.value ?? 'root')] ?? []).map(([value, text]) => ({ value, text, isLeaf: !tree[value] }))); }, 300); timers.current.add(timer);\n };\n }, []);\n const open = (key: string) => {\n 'background only'; if (!['custom', 'lazy', 'jobs'].includes(key)) {\n const all = getDemoAreaOptions(); setAreas(all);\n if (key === 'disabled') setDisabledAreas(all.map(item => item.value === '140000' ? { ...item, disabled: true } : item));\n if (key === 'tip') setTipAreas(all.map(item => item.value === '140000' ? { ...item, disabled: true, tip: '该地区无货,暂时无法选择' } : item.value === '150000' ? { ...item, tip: '该地区配送时间可能较长' } : item));\n } setOpened(key);\n };\n const row = (key: string, title: string) => <Cell key={key} title={title} value={labels[key] ?? ''} arrow onTap={() => open(key)} />;\n return <view className=\"demo-cascader-page\">\n <DemoGroup title=\"组件类型\"><CellGroup border>{row('basic', '基本用法')}{row('initial', '初始选项')}{row('custom', '自定义字段')}</CellGroup></DemoGroup>\n <DemoGroup title=\"组件状态\"><CellGroup border>{row('disabled', '禁用选项')}{row('tip', '选项提示信息')}{row('validate', 'before-confirm')}</CellGroup></DemoGroup>\n <DemoGroup title=\"组件样式\"><CellGroup border>{row('format', '展示格式化')}{row('title', '标题')}</CellGroup></DemoGroup>\n <DemoGroup title=\"特殊样式\"><CellGroup border>{row('lazy', '异步加载')}{row('jobs', '异步加载(无初始值)')}{row('strict', '任意级可选')}</CellGroup></DemoGroup>\n {Object.keys(initial).map(key => <Cascader key={key} visible={opened === key} onVisibleChange={show => { 'background only'; if (!show) setOpened(''); }} value={values[key]} options={key === 'custom' ? custom : key === 'lazy' || key === 'jobs' ? undefined : key === 'disabled' ? disabledAreas : key === 'tip' ? tipAreas : areas} valueKey={key === 'custom' ? 'id' : undefined} textKey={key === 'custom' ? 'name' : undefined} childrenKey={key === 'custom' ? 'items' : undefined} lazyLoad={key === 'lazy' || key === 'jobs' ? loaders.current[key] : undefined} title={key === 'title' ? '选择地址' : '请选择'} checkStrictly={key === 'strict'} beforeConfirm={key === 'validate' ? value => { 'background only'; if (Number(value) > 120000) { toast.error({ msg: '该地区库存不足', zIndex: 110 }); return false; } return true; } : undefined} onConfirm={({ value, selectedOptions }) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); setLabels(previous => ({ ...previous, [key]: (key === 'format' ? selectedOptions.slice(-2) : selectedOptions).map(item => item.text).join(key === 'format' ? '-' : key === 'jobs' ? ' / ' : '/') })); }} />)}\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"valueKey","type":"string","optional":true,"description":"选项值字段名"},{"name":"textKey","type":"string","optional":true,"description":"文字字段名"},{"name":"childrenKey","type":"string","optional":true,"description":"子节点字段名"},{"name":"tipKey","type":"string","optional":true,"description":"选项说明字段名"},{"name":"isLeafKey","type":"string","optional":true,"description":"叶子节点字段名"},{"name":"value","type":"CascaderValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"options","type":"readonly CascaderInput[]","optional":true,"description":"选项配置","defaultValue":"empty"},{"name":"visible","type":"boolean","optional":true,"description":"是否显示选择面板","values":[false,true]},{"name":"title","type":"string","optional":true,"description":"标题内容","defaultValue":"'请选择'"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示","defaultValue":"'请选择'"},{"name":"checkStrictly","type":"boolean","optional":true,"description":"是否允许选择中间层级","defaultValue":"false","values":[false,true]},{"name":"confirmText","type":"string","optional":true,"description":"确认文案","defaultValue":"'确认'"},{"name":"lazyLoad","type":"CascaderLazyLoad","optional":true,"description":"异步加载下一级数据"},{"name":"beforeConfirm","type":"(value: CascaderScalar, options: CascaderOption[]) => boolean | Promise<boolean>","optional":true,"description":"确认前校验"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","defaultValue":"false","values":[false,true]},{"name":"loadingColor","type":"string","optional":true,"description":"加载指示器颜色","defaultValue":"'#4D80F0'"},{"name":"lineTheme","type":"TabsLineTheme","optional":true,"description":"标签指示线外观","values":["text","underline","normal","dot"]},{"name":"lineWidth","type":"number | string","optional":true,"description":"指示线宽度"},{"name":"lineHeight","type":"number | string","optional":true,"description":"行高或指示线高度"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"100"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"面板显示状态变化时触发"},{"name":"onChange","type":"(event: CascaderSelection) => void","optional":true,"description":"值发生变化时触发"},{"name":"onConfirm","type":"(event: CascaderSelection) => void","optional":true,"description":"确认选择时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消操作时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"},{"name":"onLoadError","type":"(error: unknown) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-dark-display","description":"","defaultValue":"none"},{"name":"--cso-ui-disabled-text","description":"","defaultValue":"#c9cbd4"},{"name":"--cso-ui-light-display","description":"","defaultValue":"flex"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","层级选择"],"title":"层级选择","section":"组件类型","description":"通过 `options` 配置层级数据,子级放在 `children` 中,`visible` 控制面板显示。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择地区\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Cascader\n visible={visible}\n onVisibleChange={setVisible}\n options={[\n {\n value: 'zj',\n label: '浙江',\n children: [{ value: 'hz', label: '杭州' }],\n },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择地区\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Cascader\n visible={visible}\n onVisibleChange={setVisible}\n options={[\n {\n value: 'zj',\n label: '浙江',\n children: [{ value: 'hz', label: '杭州' }],\n },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义标题"],"title":"自定义标题","section":"组件样式","description":"通过 `title` 设置级联面板标题。","language":"tsx","code":"<Cascader\n visible={false}\n title=\"选择分类\"\n options={[{ value: 'book', label: '图书' }]}\n/>\n","blocks":[{"language":"tsx","code":"<Cascader\n visible={false}\n title=\"选择分类\"\n options={[{ value: 'book', label: '图书' }]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Cell","id":"cell","label":"Cell 单元格","category":"基础","categoryId":"basic","kind":"component","description":"单元格用于展示一项信息或提供操作入口。配合 CellGroup 可组织设置列表、详情和表单布局。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Cell.tsx","docPath":"docs/ui/components/cell.md","doc":"# Cell 单元格\n\n单元格用于展示一项信息或提供操作入口。配合 CellGroup 可组织设置列表、详情和表单布局。\n\n```tsx\nimport { Cell, CellGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础单元格\n\n通过 `title`、`value` 和 `description` 展示信息,配合 `CellGroup` 组织一组单元格。\n\n```tsx\n<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n```\n\n## 交互用法\n\n### 链接入口\n\n设置 `arrow` 展示箭头,`clickable` 展示点击状态,通过 `onTap` 处理点击。\n\n```tsx\n<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n```\n\n## 内容形态\n\n### 组合输入框\n\n子节点中可放置输入框,使用 `titleWidth` 设置标题宽度,`center` 让内容垂直居中。\n\n```tsx\nimport { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n```\n\n## Attributes 属性\n\n### Cell\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `ReactNode` | — |\n| description | 补充描述 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `string` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| icon | 图标内容 | `ReactNode` | — |\n| clickable | 是否显示可点击状态 | `boolean` | `false` |\n| arrow | 是否显示箭头 | `boolean` | `false` |\n| arrowDirection | 箭头方向 | `'right' \\| 'left' \\| 'up' \\| 'down'` | `'right'` |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | `'right'` |\n| size | 尺寸 | `'medium' \\| 'large'` | `'medium'` |\n| center | 标题与内容是否垂直居中 | `boolean` | `false` |\n| required | 是否显示必填标记 | `boolean` | `false` |\n| markerSide | 必填标记相对标题的位置 | `'before' \\| 'after'` | `'before'` |\n| vertical | 是否垂直排列 | `boolean` | `false` |\n| titleWidth | 标题区域宽度 | `string` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | `false` |\n| border | 是否显示边框 | `boolean` | — |\n| last | 是否为分组最后一项 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n### CellGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `string` | — |\n| border | 是否显示边框 | `boolean` | `false` |\n| insert | 是否使用内嵌分组样式 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Cell.onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Cell.title | 标题内容 | ReactNode |\n| Cell.icon | 图标内容 | ReactNode |\n| Cell.children | 自定义内容 | ReactNode |\n| CellGroup.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-cell-title-color` | 当前组件 |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[Cell 组件源码](./sources/cell/Cell.tsx.txt) · [CellGroup 组件源码](./sources/cell/Cell.tsx.txt) · [示例源码](./sources/cell/demo.tsx.txt) · [文档源码](./sources/cell/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Switch, SwitchThumb, SwitchTrack } from '@lynx-js/lynx-ui';\nimport { Button, Cell, CellGroup, Slider } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst poem = '黄鹤断矶头,故人今在否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。';\nconst starPath = 'm12 2 3 6.2 6.8 1-4.9 4.8 1.2 6.8L12 17.6l-6.1 3.2 1.2-6.8-4.9-4.8 6.8-1Z';\nconst settingsPath = '<path d=\"m9 3-.7 2.2-2 .8-2.1-1-2 3.4L4 10v2l-1.8 1.6 2 3.4 2.1-1 2 .8L9 19h4l.7-2.2 2-.8 2.1 1 2-3.4L18 12v-2l1.8-1.6-2-3.4-2.1 1-2-.8L13 3Z\"/><circle cx=\"11\" cy=\"11\" r=\"3\"/>';\n\nfunction SettingsIcon() {\n const markup = (color: string) => `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 22 22\" fill=\"none\" stroke=\"${color}\" stroke-width=\"1.7\" stroke-linejoin=\"round\">${settingsPath}</svg>`;\n return <view className=\"demo-cell-settings\"><svg className=\"ui-demo-icon-light\" content={markup('#4e5369')} /><svg className=\"ui-demo-icon-dark\" content={markup('#e5e6eb')} /></view>;\n}\n\nfunction DemoRating({ label }: { label: string }) {\n const [value, setValue] = useState(0);\n return <view className=\"demo-cell-rating\">{[1, 2, 3, 4, 5].map(score => <view key={score} className={`demo-cell-star ${score <= value ? 'demo-cell-star-selected' : ''}`} accessibility-element accessibility-traits=\"button\" accessibility-label={`${label}:${score} 星`} bindtap={() => { 'background only'; setValue(score); }}><svg content={`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"${starPath}\" fill=\"${score <= value ? '#1c64fd' : '#c9cbd4'}\" stroke=\"${score <= value ? '#1c64fd' : '#c9cbd4'}\" stroke-linejoin=\"round\"/></svg>`} /></view>)}</view>;\n}\n\nfunction DemoSwitch() {\n const [checked, setChecked] = useState(false);\n const change = (next: boolean) => { 'background only'; setChecked(next); };\n return <view className=\"demo-cell-switch-wrap\"><Switch className=\"demo-cell-switch\" checked={checked} onChange={change} switchProps={{ 'accessibility-label': '自定义开关' }}><SwitchTrack className=\"demo-cell-switch-track\" /><SwitchThumb className=\"demo-cell-switch-thumb\" /></Switch></view>;\n}\n\nexport function CellExample({ onHome, onButton }: { onHome: () => void; onButton: () => void }) {\n const [notice, setNotice] = useState(0);\n const showNotice = () => { 'background only'; setNotice(count => count + 1); };\n useEffect(() => {\n if (!notice) return;\n const timer = setTimeout(() => setNotice(0), 1500);\n return () => clearTimeout(timer);\n }, [notice]);\n return <view className=\"demo-cell-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"分组标题\" noPadding><CellGroup title=\"交易管理\" value=\"内容\"><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description={poem} value=\"内容\" /></CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"点击事件\" noPadding><Cell title=\"标题文字\" value=\"内容\" clickable onTap={showNotice} className=\"demo-cell-clickable\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"Placeholder\" noPadding><CellGroup><Cell title=\"用户名\" placeholder=\"请输入用户名\" /><Cell title=\"手机号\" value=\"188****8888\" placeholder=\"请输入手机号\" /><Cell title=\"左对齐\" placeholder=\"请输入内容\" valueAlign=\"left\" /><Cell title=\"居中对齐\" placeholder=\"请输入内容\" valueAlign=\"center\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"页面跳转\" noPadding><CellGroup><Cell title=\"帮助与反馈\" arrow onTap={onHome} /><Cell title=\"设置\" value=\"内容\" arrow onTap={onButton} /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"箭头方向\" noPadding><CellGroup>{([{ title: '向上箭头', arrowDirection: 'up' }, { title: '向下箭头', arrowDirection: 'down' }, { title: '向左箭头', arrowDirection: 'left' }, { title: '默认箭头(向右)', arrowDirection: 'right' }] as const).map(item => <Cell key={item.arrowDirection} {...item} arrow />)}</CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"卡片风格\" noPadding><CellGroup insert><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"图标\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" icon={<SettingsIcon />} /><Cell title=\"标题文字\" value=\"内容\" className=\"demo-cell-custom-icon-row\" icon={<view className=\"demo-cell-custom-icon\"><view className=\"demo-cell-note\"><view /><view /></view></view>} /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"大尺寸\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" size=\"large\" /><Cell title=\"标题文字\" value=\"内容\" size=\"large\" icon={<SettingsIcon />} arrow /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" size=\"large\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"垂直居中\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" center /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" center /></CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"展示边框线\" noPadding><CellGroup title=\"交易管理\" border><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"这一个cell不想要边框\" value=\"内容\" border={false} /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"表单属性\" noPadding><CellGroup border><Cell title=\"必填\" required><DemoRating label=\"必填评分\" /></Cell><Cell title=\"必填星号在右\" required markerSide=\"after\"><DemoRating label=\"右侧标记评分\" /></Cell><Cell title=\"上下结构\" required markerSide=\"after\" vertical><Slider defaultValue={0} /></Cell></CellGroup></ExampleBlock>\n <ExampleBlock title=\"设置宽度\" noPadding><Cell title=\"标题文字\" description=\"这里是文字描述这里是文字描述这里是文字描述\" titleWidth=\"200px\" value=\"内容\" /></ExampleBlock>\n <ExampleBlock title=\"省略号显示\" noPadding><CellGroup><Cell title=\"正常显示\" value=\"这是一段很长的文字内容,通常情况下会完整显示\" /><Cell title=\"省略号显示\" value=\"这是一段很长的文字内容,当启用ellipsis属性时,超出部分将显示省略号\" ellipsis /><Cell title=\"左对齐省略\" value=\"这是一段很长的文字内容,左对齐并启用省略号功能\" valueAlign=\"left\" ellipsis /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"自定义内容\" noPadding><CellGroup><Cell title=\"标题文字\" center><Button label=\"按钮\" size=\"small\" variant=\"plain\" onTap={showNotice} /></Cell><Cell title=\"标题文字\" center><DemoSwitch /></Cell><Cell title=\"标题文字\" arrow onTap={onHome}><text className=\"demo-cell-order\">订购</text></Cell><Cell title={<view className=\"demo-cell-custom-title\"><text>标题文字</text><text className=\"demo-cell-expiry\">25天后到期</text></view>} /></CellGroup></ExampleBlock>\n </DemoGroup>\n {notice ? <view className=\"demo-cell-toast\" user-interaction-enabled={false}><text>点击</text></view> : null}\n </view>;\n}\n","props":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"description","type":"string","optional":true,"description":"补充描述"},{"name":"value","type":"string","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"},{"name":"clickable","type":"boolean","optional":true,"description":"是否显示可点击状态","defaultValue":"false","values":[false,true]},{"name":"arrow","type":"boolean","optional":true,"description":"是否显示箭头","defaultValue":"false","values":[false,true]},{"name":"arrowDirection","type":"'right' | 'left' | 'up' | 'down'","optional":true,"description":"箭头方向","defaultValue":"'right'","values":["left","right","down","up"]},{"name":"valueAlign","type":"'left' | 'center' | 'right'","optional":true,"description":"值区域对齐方式","defaultValue":"'right'","values":["left","right","center"]},{"name":"size","type":"'medium' | 'large'","optional":true,"description":"尺寸","defaultValue":"'medium'","values":["medium","large"]},{"name":"center","type":"boolean","optional":true,"description":"标题与内容是否垂直居中","defaultValue":"false","values":[false,true]},{"name":"required","type":"boolean","optional":true,"description":"是否显示必填标记","defaultValue":"false","values":[false,true]},{"name":"markerSide","type":"'before' | 'after'","optional":true,"description":"必填标记相对标题的位置","defaultValue":"'before'","values":["before","after"]},{"name":"vertical","type":"boolean","optional":true,"description":"是否垂直排列","defaultValue":"false","values":[false,true]},{"name":"titleWidth","type":"string","optional":true,"description":"标题区域宽度"},{"name":"ellipsis","type":"boolean","optional":true,"description":"是否截断超出范围的文字","defaultValue":"false","values":[false,true]},{"name":"border","type":"boolean","optional":true,"description":"是否显示边框","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"是否为分组最后一项","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":""}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-cell-title-color","defaultValue":"var(--cso-ui-text)","description":""},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","基础单元格"],"title":"基础单元格","section":"组件类型","description":"通过 `title`、`value` 和 `description` 展示信息,配合 `CellGroup` 组织一组单元格。","language":"tsx","code":"<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n","blocks":[{"language":"tsx","code":"<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n"}]},{"name":"demo-2","aliases":["demo-2","链接入口"],"title":"链接入口","section":"交互用法","description":"设置 `arrow` 展示箭头,`clickable` 展示点击状态,通过 `onTap` 处理点击。","language":"tsx","code":"<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","组合输入框"],"title":"组合输入框","section":"内容形态","description":"子节点中可放置输入框,使用 `titleWidth` 设置标题宽度,`center` 让内容垂直居中。","language":"tsx","code":"import { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n","blocks":[{"language":"tsx","code":"import { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n"}]}],"allowUnknownProps":false},{"name":"CellGroup","id":"cell","label":"Cell 单元格","category":"基础","categoryId":"basic","kind":"component","description":"单元格用于展示一项信息或提供操作入口。配合 CellGroup 可组织设置列表、详情和表单布局。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Cell.tsx","docPath":"docs/ui/components/cell.md","doc":"# Cell 单元格\n\n单元格用于展示一项信息或提供操作入口。配合 CellGroup 可组织设置列表、详情和表单布局。\n\n```tsx\nimport { Cell, CellGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础单元格\n\n通过 `title`、`value` 和 `description` 展示信息,配合 `CellGroup` 组织一组单元格。\n\n```tsx\n<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n```\n\n## 交互用法\n\n### 链接入口\n\n设置 `arrow` 展示箭头,`clickable` 展示点击状态,通过 `onTap` 处理点击。\n\n```tsx\n<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n```\n\n## 内容形态\n\n### 组合输入框\n\n子节点中可放置输入框,使用 `titleWidth` 设置标题宽度,`center` 让内容垂直居中。\n\n```tsx\nimport { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n```\n\n## Attributes 属性\n\n### Cell\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `ReactNode` | — |\n| description | 补充描述 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `string` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| icon | 图标内容 | `ReactNode` | — |\n| clickable | 是否显示可点击状态 | `boolean` | `false` |\n| arrow | 是否显示箭头 | `boolean` | `false` |\n| arrowDirection | 箭头方向 | `'right' \\| 'left' \\| 'up' \\| 'down'` | `'right'` |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | `'right'` |\n| size | 尺寸 | `'medium' \\| 'large'` | `'medium'` |\n| center | 标题与内容是否垂直居中 | `boolean` | `false` |\n| required | 是否显示必填标记 | `boolean` | `false` |\n| markerSide | 必填标记相对标题的位置 | `'before' \\| 'after'` | `'before'` |\n| vertical | 是否垂直排列 | `boolean` | `false` |\n| titleWidth | 标题区域宽度 | `string` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | `false` |\n| border | 是否显示边框 | `boolean` | — |\n| last | 是否为分组最后一项 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n### CellGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `string` | — |\n| border | 是否显示边框 | `boolean` | `false` |\n| insert | 是否使用内嵌分组样式 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Cell.onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Cell.title | 标题内容 | ReactNode |\n| Cell.icon | 图标内容 | ReactNode |\n| Cell.children | 自定义内容 | ReactNode |\n| CellGroup.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-cell-title-color` | 当前组件 |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[Cell 组件源码](./sources/cell/Cell.tsx.txt) · [CellGroup 组件源码](./sources/cell/Cell.tsx.txt) · [示例源码](./sources/cell/demo.tsx.txt) · [文档源码](./sources/cell/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Switch, SwitchThumb, SwitchTrack } from '@lynx-js/lynx-ui';\nimport { Button, Cell, CellGroup, Slider } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst poem = '黄鹤断矶头,故人今在否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。';\nconst starPath = 'm12 2 3 6.2 6.8 1-4.9 4.8 1.2 6.8L12 17.6l-6.1 3.2 1.2-6.8-4.9-4.8 6.8-1Z';\nconst settingsPath = '<path d=\"m9 3-.7 2.2-2 .8-2.1-1-2 3.4L4 10v2l-1.8 1.6 2 3.4 2.1-1 2 .8L9 19h4l.7-2.2 2-.8 2.1 1 2-3.4L18 12v-2l1.8-1.6-2-3.4-2.1 1-2-.8L13 3Z\"/><circle cx=\"11\" cy=\"11\" r=\"3\"/>';\n\nfunction SettingsIcon() {\n const markup = (color: string) => `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 22 22\" fill=\"none\" stroke=\"${color}\" stroke-width=\"1.7\" stroke-linejoin=\"round\">${settingsPath}</svg>`;\n return <view className=\"demo-cell-settings\"><svg className=\"ui-demo-icon-light\" content={markup('#4e5369')} /><svg className=\"ui-demo-icon-dark\" content={markup('#e5e6eb')} /></view>;\n}\n\nfunction DemoRating({ label }: { label: string }) {\n const [value, setValue] = useState(0);\n return <view className=\"demo-cell-rating\">{[1, 2, 3, 4, 5].map(score => <view key={score} className={`demo-cell-star ${score <= value ? 'demo-cell-star-selected' : ''}`} accessibility-element accessibility-traits=\"button\" accessibility-label={`${label}:${score} 星`} bindtap={() => { 'background only'; setValue(score); }}><svg content={`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"${starPath}\" fill=\"${score <= value ? '#1c64fd' : '#c9cbd4'}\" stroke=\"${score <= value ? '#1c64fd' : '#c9cbd4'}\" stroke-linejoin=\"round\"/></svg>`} /></view>)}</view>;\n}\n\nfunction DemoSwitch() {\n const [checked, setChecked] = useState(false);\n const change = (next: boolean) => { 'background only'; setChecked(next); };\n return <view className=\"demo-cell-switch-wrap\"><Switch className=\"demo-cell-switch\" checked={checked} onChange={change} switchProps={{ 'accessibility-label': '自定义开关' }}><SwitchTrack className=\"demo-cell-switch-track\" /><SwitchThumb className=\"demo-cell-switch-thumb\" /></Switch></view>;\n}\n\nexport function CellExample({ onHome, onButton }: { onHome: () => void; onButton: () => void }) {\n const [notice, setNotice] = useState(0);\n const showNotice = () => { 'background only'; setNotice(count => count + 1); };\n useEffect(() => {\n if (!notice) return;\n const timer = setTimeout(() => setNotice(0), 1500);\n return () => clearTimeout(timer);\n }, [notice]);\n return <view className=\"demo-cell-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"分组标题\" noPadding><CellGroup title=\"交易管理\" value=\"内容\"><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description={poem} value=\"内容\" /></CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"点击事件\" noPadding><Cell title=\"标题文字\" value=\"内容\" clickable onTap={showNotice} className=\"demo-cell-clickable\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"Placeholder\" noPadding><CellGroup><Cell title=\"用户名\" placeholder=\"请输入用户名\" /><Cell title=\"手机号\" value=\"188****8888\" placeholder=\"请输入手机号\" /><Cell title=\"左对齐\" placeholder=\"请输入内容\" valueAlign=\"left\" /><Cell title=\"居中对齐\" placeholder=\"请输入内容\" valueAlign=\"center\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"页面跳转\" noPadding><CellGroup><Cell title=\"帮助与反馈\" arrow onTap={onHome} /><Cell title=\"设置\" value=\"内容\" arrow onTap={onButton} /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"箭头方向\" noPadding><CellGroup>{([{ title: '向上箭头', arrowDirection: 'up' }, { title: '向下箭头', arrowDirection: 'down' }, { title: '向左箭头', arrowDirection: 'left' }, { title: '默认箭头(向右)', arrowDirection: 'right' }] as const).map(item => <Cell key={item.arrowDirection} {...item} arrow />)}</CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"卡片风格\" noPadding><CellGroup insert><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"图标\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" icon={<SettingsIcon />} /><Cell title=\"标题文字\" value=\"内容\" className=\"demo-cell-custom-icon-row\" icon={<view className=\"demo-cell-custom-icon\"><view className=\"demo-cell-note\"><view /><view /></view></view>} /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"大尺寸\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" size=\"large\" /><Cell title=\"标题文字\" value=\"内容\" size=\"large\" icon={<SettingsIcon />} arrow /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" size=\"large\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"垂直居中\" noPadding><CellGroup><Cell title=\"标题文字\" value=\"内容\" center /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" center /></CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"展示边框线\" noPadding><CellGroup title=\"交易管理\" border><Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"这一个cell不想要边框\" value=\"内容\" border={false} /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"表单属性\" noPadding><CellGroup border><Cell title=\"必填\" required><DemoRating label=\"必填评分\" /></Cell><Cell title=\"必填星号在右\" required markerSide=\"after\"><DemoRating label=\"右侧标记评分\" /></Cell><Cell title=\"上下结构\" required markerSide=\"after\" vertical><Slider defaultValue={0} /></Cell></CellGroup></ExampleBlock>\n <ExampleBlock title=\"设置宽度\" noPadding><Cell title=\"标题文字\" description=\"这里是文字描述这里是文字描述这里是文字描述\" titleWidth=\"200px\" value=\"内容\" /></ExampleBlock>\n <ExampleBlock title=\"省略号显示\" noPadding><CellGroup><Cell title=\"正常显示\" value=\"这是一段很长的文字内容,通常情况下会完整显示\" /><Cell title=\"省略号显示\" value=\"这是一段很长的文字内容,当启用ellipsis属性时,超出部分将显示省略号\" ellipsis /><Cell title=\"左对齐省略\" value=\"这是一段很长的文字内容,左对齐并启用省略号功能\" valueAlign=\"left\" ellipsis /></CellGroup></ExampleBlock>\n <ExampleBlock title=\"自定义内容\" noPadding><CellGroup><Cell title=\"标题文字\" center><Button label=\"按钮\" size=\"small\" variant=\"plain\" onTap={showNotice} /></Cell><Cell title=\"标题文字\" center><DemoSwitch /></Cell><Cell title=\"标题文字\" arrow onTap={onHome}><text className=\"demo-cell-order\">订购</text></Cell><Cell title={<view className=\"demo-cell-custom-title\"><text>标题文字</text><text className=\"demo-cell-expiry\">25天后到期</text></view>} /></CellGroup></ExampleBlock>\n </DemoGroup>\n {notice ? <view className=\"demo-cell-toast\" user-interaction-enabled={false}><text>点击</text></view> : null}\n </view>;\n}\n","props":[{"name":"title","type":"string","optional":true,"description":"标题内容"},{"name":"value","type":"string","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"border","type":"boolean","optional":true,"description":"是否显示边框","defaultValue":"false","values":[false,true]},{"name":"insert","type":"boolean","optional":true,"description":"是否使用内嵌分组样式","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-cell-title-color","defaultValue":"var(--cso-ui-text)","description":""},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","基础单元格"],"title":"基础单元格","section":"组件类型","description":"通过 `title`、`value` 和 `description` 展示信息,配合 `CellGroup` 组织一组单元格。","language":"tsx","code":"<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n","blocks":[{"language":"tsx","code":"<CellGroup border>\n <Cell title=\"单元格\" value=\"内容\" />\n <Cell title=\"带描述\" description=\"补充说明\" value=\"内容\" />\n</CellGroup>\n"}]},{"name":"demo-2","aliases":["demo-2","链接入口"],"title":"链接入口","section":"交互用法","description":"设置 `arrow` 展示箭头,`clickable` 展示点击状态,通过 `onTap` 处理点击。","language":"tsx","code":"<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Cell\n title=\"个人资料\"\n arrow\n clickable\n onTap={() => {\n 'background only';\n console.log('打开资料');\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","组合输入框"],"title":"组合输入框","section":"内容形态","description":"子节点中可放置输入框,使用 `titleWidth` 设置标题宽度,`center` 让内容垂直居中。","language":"tsx","code":"import { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n","blocks":[{"language":"tsx","code":"import { Input } from 'daisu-ui';\n\n<Cell title=\"姓名\" titleWidth=\"98px\" required center>\n <Input compact placeholder=\"请输入姓名\" />\n</Cell>\n"}]}],"allowUnknownProps":false},{"name":"Checkbox","id":"checkbox","label":"Checkbox 复选框","category":"录入","categoryId":"form","kind":"component","description":"复选框用于选择一个或多个选项,支持分组、禁用、只读和按钮外观。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Checkbox.tsx","docPath":"docs/ui/components/checkbox.md","doc":"# Checkbox 复选框\n\n复选框用于选择一个或多个选项,支持分组、禁用、只读和按钮外观。\n\n```tsx\nimport { Checkbox, CheckboxGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 独立复选框\n\n通过 `value` 表示选中状态,`onChange` 返回变化后的值,子节点用于显示选项文案。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n```\n\n## 组合用法\n\n### 复选框组\n\n在 `CheckboxGroup` 中组合多个选项,`defaultValue` 设置默认选中的值列表。\n\n```tsx\n<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n```\n\n## 组件状态\n\n### 禁用与按钮样式\n\n设置 `disabled` 禁用选项,设置分组的 `type=\"button\"` 使用按钮外观。\n\n```tsx\n<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n```\n\n## Attributes 属性\n\n### Checkbox\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| name | 名称或标识 | `ChoiceValue` | — |\n| value | 当前值;传入后由调用方更新 | `ChoiceValue` | — |\n| defaultValue | 非受控模式的初始值 | `ChoiceValue` | — |\n| trueValue | 选中状态对应的值 | `ChoiceValue` | — |\n| falseValue | 未选中状态对应的值 | `ChoiceValue` | — |\n| indeterminate | 是否显示半选状态 | `boolean` | — |\n\n### CheckboxGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `readonly ChoiceValue[]` | — |\n| defaultValue | 非受控模式的初始值 | `readonly ChoiceValue[]` | — |\n| min | 最小值 | `number` | — |\n| max | 最大值或数量上限 | `number` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Checkbox.onChange | 值发生变化时触发 | (event: { value: ChoiceValue }) => void |\n| CheckboxGroup.onChange | 值发生变化时触发 | (event: { value: ChoiceValue[] }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Checkbox.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| Checkbox.children | 自定义内容 | ReactNode |\n| CheckboxGroup.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| CheckboxGroup.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| toggle | 调用实例方法 | () => void |\n| toggleAll | 调用实例方法 | (options?: boolean \\| { checked?: boolean; skipDisabled?: boolean }) => void |\n\n## 数据类型\n\n```tsx\nexport type ChoiceType = 'circle' | 'square' | 'dot' | 'button';\n\nexport type ChoiceValue = string | number | boolean;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Checkbox 组件源码](./sources/checkbox/Checkbox.tsx.txt) · [CheckboxGroup 组件源码](./sources/checkbox/Checkbox.tsx.txt) · [示例源码](./sources/checkbox/demo.tsx.txt) · [文档源码](./sources/checkbox/docs.md.txt)\n","demoSource":"import { useRef,useState } from '@lynx-js/react';import { Button, Cell, CellGroup, Checkbox, CheckboxGroup, Divider, Icon } from 'daisu-ui';import type { CheckboxGroupProps, CheckboxGroupRef, CheckboxProps, ChoiceValue } from 'daisu-ui';import { DemoGroup,ExampleBlock } from './shared.js';\ntype Item=Pick<CheckboxProps,'name'|'type'|'placement'|'disabled'|'renderIcon'>&{label:string};\nconst basic:Item[]=Array.from({length:7},(_,i)=>({name:i+1,type:i===2||i===3?'square':i===4||i===5?'dot':'circle',label:i===6?'多选'.repeat(15):`多选 ${i+1}`})),two:Item[]=[{name:1,label:'多选 1'},{name:2,label:'多选 2'}];\nfunction Sample({items=two,defaultValue=[1],...props}:CheckboxGroupProps&{items?:Item[]}){const[value,setValue]=useState<readonly ChoiceValue[]>(defaultValue);return <CheckboxGroup {...props} value={value} onChange={({value})=>setValue(value)} className={`demo-choice-group ${props.className??''}`}>{items.map(({label,...item})=><Checkbox key={String(item.name)} {...item}>{label}</Checkbox>)}</CheckboxGroup>;}\nfunction Standalone({custom=false,half=false}:{custom?:boolean;half?:boolean}){const[value,setValue]=useState<ChoiceValue>(custom?'yes':false),[indeterminate,setIndeterminate]=useState(half);return <Checkbox value={value} trueValue={custom?'yes':true} falseValue={custom?'no':false} indeterminate={indeterminate} onChange={({value})=>{'background only';setValue(value);setIndeterminate(false);}}>{half?'半选状态':'多选 1'}</Checkbox>;}\nexport function CheckboxExample(){const[group,setGroup]=useState<ChoiceValue[]>([1]),[all,setAll]=useState<ChoiceValue[]>([]),ref=useRef<CheckboxGroupRef>(null);const toggle=(value:number)=>{'background only';setGroup(old=>old.includes(value)?old.filter(v=>v!==value):[...old,value]);};return <view className=\"demo-checkbox-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Sample items={basic}/></ExampleBlock><ExampleBlock title=\"单独使用\"><Standalone/></ExampleBlock></DemoGroup><DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用状态\"><Sample disabled/><Divider dashed className=\"demo-checkbox-divider\"/><Sample items={[two[0]!,{...two[1]!,disabled:true}]}/></ExampleBlock><ExampleBlock title=\"半选状态\"><Standalone half/></ExampleBlock><ExampleBlock title=\"只读状态\"><Sample readonly/></ExampleBlock></DemoGroup><DemoGroup title=\"组件变体\"><ExampleBlock title=\"勾选在右侧\"><Sample items={basic} placement=\"right\"/></ExampleBlock><ExampleBlock title=\"修改形状: button\"><Sample type=\"button\"/></ExampleBlock><ExampleBlock title=\"同行展示\"><Sample direction=\"horizontal\"/></ExampleBlock><ExampleBlock title=\"设置最小选中数量和最大选中数量\"><Sample min={1} max={3} defaultValue={[1,2]} items={[...two,{name:3,label:'多选 3'},{name:4,label:'多选 4'}]}/></ExampleBlock><ExampleBlock title=\"自定义选中/非选中值\"><Standalone custom/></ExampleBlock></DemoGroup><DemoGroup title=\"组件样式\"><ExampleBlock title=\"修改选中颜色\"><Sample checkedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"修改未选中颜色\"><Sample uncheckedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"自定义图标\"><Sample items={[1,2].map(name=>({name,label:'自定义图标',renderIcon:({isChecked})=><Icon name={isChecked?'star-fill':'star'} size={22} color={isChecked?'#f14646':'#a9acb8'}/>}))}/></ExampleBlock><ExampleBlock title=\"大尺寸\"><Sample size=\"large\" className=\"demo-checkbox-large\"/></ExampleBlock></DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"结合Cell使用\" noPadding><CheckboxGroup value={group} onChange={({value})=>setGroup(value)} direction=\"horizontal\"><CellGroup border>{['点赞','投币','一键三连'].map((label,i)=><Cell key={label} title={label} clickable center onTap={()=>toggle(i+1)}><Checkbox name={i+1}/></Cell>)}</CellGroup></CheckboxGroup></ExampleBlock><ExampleBlock title=\"全选切换\"><view className=\"demo-checkbox-actions\">{([{label:'全部切换',tone:'neutral',action:undefined},{label:'全选',tone:'success',action:true},{label:'全不选',tone:'primary',action:false},{label:'全部切换跳过禁用',tone:'warning',action:{skipDisabled:true}},{label:'全部选中跳过禁用',tone:'danger',action:{checked:true,skipDisabled:true}}] as const).map(item=><Button size=\"small\" key={item.label} label={item.label} tone={item.tone} onTap={()=>ref.current?.toggleAll(item.action)}/>)}</view><CheckboxGroup ref={ref} value={all} onChange={({value})=>setAll(value)} className=\"demo-choice-group\">{[1,2,3,4].map(name=><Checkbox key={name} name={name} disabled={name===3}>{`多选 ${name}${name===3?'(Disabled)':''}`}</Checkbox>)}</CheckboxGroup></ExampleBlock></DemoGroup></view>;}\n","props":[{"name":"type","type":"ChoiceType","optional":true,"description":"类型","values":["dot","circle","square","button"]},{"name":"checkedColor","type":"string","optional":true,"description":"选中颜色"},{"name":"uncheckedColor","type":"string","optional":true,"description":"未选中颜色"},{"name":"disabled","type":"boolean | null","optional":true,"description":"是否禁用"},{"name":"readonly","type":"boolean | null","optional":true,"description":"是否只读"},{"name":"placement","type":"'left' | 'right'","optional":true,"description":"浮层相对触发元素的位置","values":["left","right"]},{"name":"direction","type":"'horizontal' | 'vertical'","optional":true,"description":"布局或展开方向","values":["vertical","horizontal"]},{"name":"size","type":"'large'","optional":true,"description":"尺寸","values":["large"]},{"name":"maxWidth","type":"string","optional":true,"description":"最大宽度"},{"name":"labelClassName","type":"string","optional":true,"description":"选项文字类名"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"name","type":"ChoiceValue","optional":true,"description":"名称或标识"},{"name":"value","type":"ChoiceValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"ChoiceValue","optional":true,"description":"非受控模式的初始值"},{"name":"trueValue","type":"ChoiceValue","optional":true,"description":"选中状态对应的值"},{"name":"falseValue","type":"ChoiceValue","optional":true,"description":"未选中状态对应的值"},{"name":"indeterminate","type":"boolean","optional":true,"description":"是否显示半选状态","values":[false,true]}],"events":[{"name":"onChange","type":"(event: { value: ChoiceValue }) => void","optional":true,"description":""}],"slots":[{"name":"renderIcon","type":"(state: { isChecked: boolean }) => ReactNode","optional":true,"description":""},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"toggle","description":"调用实例方法","type":"() => void"},{"name":"toggleAll","description":"调用实例方法","type":"(options?: boolean | { checked?: boolean; skipDisabled?: boolean }) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","独立复选框"],"title":"独立复选框","section":"组件类型","description":"通过 `value` 表示选中状态,`onChange` 返回变化后的值,子节点用于显示选项文案。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n"}]},{"name":"demo-2","aliases":["demo-2","复选框组"],"title":"复选框组","section":"组合用法","description":"在 `CheckboxGroup` 中组合多个选项,`defaultValue` 设置默认选中的值列表。","language":"tsx","code":"<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n","blocks":[{"language":"tsx","code":"<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用与按钮样式"],"title":"禁用与按钮样式","section":"组件状态","description":"设置 `disabled` 禁用选项,设置分组的 `type=\"button\"` 使用按钮外观。","language":"tsx","code":"<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n","blocks":[{"language":"tsx","code":"<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n"}]}],"allowUnknownProps":false},{"name":"CheckboxGroup","id":"checkbox","label":"Checkbox 复选框","category":"录入","categoryId":"form","kind":"component","description":"复选框用于选择一个或多个选项,支持分组、禁用、只读和按钮外观。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Checkbox.tsx","docPath":"docs/ui/components/checkbox.md","doc":"# Checkbox 复选框\n\n复选框用于选择一个或多个选项,支持分组、禁用、只读和按钮外观。\n\n```tsx\nimport { Checkbox, CheckboxGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 独立复选框\n\n通过 `value` 表示选中状态,`onChange` 返回变化后的值,子节点用于显示选项文案。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n```\n\n## 组合用法\n\n### 复选框组\n\n在 `CheckboxGroup` 中组合多个选项,`defaultValue` 设置默认选中的值列表。\n\n```tsx\n<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n```\n\n## 组件状态\n\n### 禁用与按钮样式\n\n设置 `disabled` 禁用选项,设置分组的 `type=\"button\"` 使用按钮外观。\n\n```tsx\n<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n```\n\n## Attributes 属性\n\n### Checkbox\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| name | 名称或标识 | `ChoiceValue` | — |\n| value | 当前值;传入后由调用方更新 | `ChoiceValue` | — |\n| defaultValue | 非受控模式的初始值 | `ChoiceValue` | — |\n| trueValue | 选中状态对应的值 | `ChoiceValue` | — |\n| falseValue | 未选中状态对应的值 | `ChoiceValue` | — |\n| indeterminate | 是否显示半选状态 | `boolean` | — |\n\n### CheckboxGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `readonly ChoiceValue[]` | — |\n| defaultValue | 非受控模式的初始值 | `readonly ChoiceValue[]` | — |\n| min | 最小值 | `number` | — |\n| max | 最大值或数量上限 | `number` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Checkbox.onChange | 值发生变化时触发 | (event: { value: ChoiceValue }) => void |\n| CheckboxGroup.onChange | 值发生变化时触发 | (event: { value: ChoiceValue[] }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Checkbox.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| Checkbox.children | 自定义内容 | ReactNode |\n| CheckboxGroup.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| CheckboxGroup.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| toggle | 调用实例方法 | () => void |\n| toggleAll | 调用实例方法 | (options?: boolean \\| { checked?: boolean; skipDisabled?: boolean }) => void |\n\n## 数据类型\n\n```tsx\nexport type ChoiceType = 'circle' | 'square' | 'dot' | 'button';\n\nexport type ChoiceValue = string | number | boolean;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Checkbox 组件源码](./sources/checkbox/Checkbox.tsx.txt) · [CheckboxGroup 组件源码](./sources/checkbox/Checkbox.tsx.txt) · [示例源码](./sources/checkbox/demo.tsx.txt) · [文档源码](./sources/checkbox/docs.md.txt)\n","demoSource":"import { useRef,useState } from '@lynx-js/react';import { Button, Cell, CellGroup, Checkbox, CheckboxGroup, Divider, Icon } from 'daisu-ui';import type { CheckboxGroupProps, CheckboxGroupRef, CheckboxProps, ChoiceValue } from 'daisu-ui';import { DemoGroup,ExampleBlock } from './shared.js';\ntype Item=Pick<CheckboxProps,'name'|'type'|'placement'|'disabled'|'renderIcon'>&{label:string};\nconst basic:Item[]=Array.from({length:7},(_,i)=>({name:i+1,type:i===2||i===3?'square':i===4||i===5?'dot':'circle',label:i===6?'多选'.repeat(15):`多选 ${i+1}`})),two:Item[]=[{name:1,label:'多选 1'},{name:2,label:'多选 2'}];\nfunction Sample({items=two,defaultValue=[1],...props}:CheckboxGroupProps&{items?:Item[]}){const[value,setValue]=useState<readonly ChoiceValue[]>(defaultValue);return <CheckboxGroup {...props} value={value} onChange={({value})=>setValue(value)} className={`demo-choice-group ${props.className??''}`}>{items.map(({label,...item})=><Checkbox key={String(item.name)} {...item}>{label}</Checkbox>)}</CheckboxGroup>;}\nfunction Standalone({custom=false,half=false}:{custom?:boolean;half?:boolean}){const[value,setValue]=useState<ChoiceValue>(custom?'yes':false),[indeterminate,setIndeterminate]=useState(half);return <Checkbox value={value} trueValue={custom?'yes':true} falseValue={custom?'no':false} indeterminate={indeterminate} onChange={({value})=>{'background only';setValue(value);setIndeterminate(false);}}>{half?'半选状态':'多选 1'}</Checkbox>;}\nexport function CheckboxExample(){const[group,setGroup]=useState<ChoiceValue[]>([1]),[all,setAll]=useState<ChoiceValue[]>([]),ref=useRef<CheckboxGroupRef>(null);const toggle=(value:number)=>{'background only';setGroup(old=>old.includes(value)?old.filter(v=>v!==value):[...old,value]);};return <view className=\"demo-checkbox-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Sample items={basic}/></ExampleBlock><ExampleBlock title=\"单独使用\"><Standalone/></ExampleBlock></DemoGroup><DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用状态\"><Sample disabled/><Divider dashed className=\"demo-checkbox-divider\"/><Sample items={[two[0]!,{...two[1]!,disabled:true}]}/></ExampleBlock><ExampleBlock title=\"半选状态\"><Standalone half/></ExampleBlock><ExampleBlock title=\"只读状态\"><Sample readonly/></ExampleBlock></DemoGroup><DemoGroup title=\"组件变体\"><ExampleBlock title=\"勾选在右侧\"><Sample items={basic} placement=\"right\"/></ExampleBlock><ExampleBlock title=\"修改形状: button\"><Sample type=\"button\"/></ExampleBlock><ExampleBlock title=\"同行展示\"><Sample direction=\"horizontal\"/></ExampleBlock><ExampleBlock title=\"设置最小选中数量和最大选中数量\"><Sample min={1} max={3} defaultValue={[1,2]} items={[...two,{name:3,label:'多选 3'},{name:4,label:'多选 4'}]}/></ExampleBlock><ExampleBlock title=\"自定义选中/非选中值\"><Standalone custom/></ExampleBlock></DemoGroup><DemoGroup title=\"组件样式\"><ExampleBlock title=\"修改选中颜色\"><Sample checkedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"修改未选中颜色\"><Sample uncheckedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"自定义图标\"><Sample items={[1,2].map(name=>({name,label:'自定义图标',renderIcon:({isChecked})=><Icon name={isChecked?'star-fill':'star'} size={22} color={isChecked?'#f14646':'#a9acb8'}/>}))}/></ExampleBlock><ExampleBlock title=\"大尺寸\"><Sample size=\"large\" className=\"demo-checkbox-large\"/></ExampleBlock></DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"结合Cell使用\" noPadding><CheckboxGroup value={group} onChange={({value})=>setGroup(value)} direction=\"horizontal\"><CellGroup border>{['点赞','投币','一键三连'].map((label,i)=><Cell key={label} title={label} clickable center onTap={()=>toggle(i+1)}><Checkbox name={i+1}/></Cell>)}</CellGroup></CheckboxGroup></ExampleBlock><ExampleBlock title=\"全选切换\"><view className=\"demo-checkbox-actions\">{([{label:'全部切换',tone:'neutral',action:undefined},{label:'全选',tone:'success',action:true},{label:'全不选',tone:'primary',action:false},{label:'全部切换跳过禁用',tone:'warning',action:{skipDisabled:true}},{label:'全部选中跳过禁用',tone:'danger',action:{checked:true,skipDisabled:true}}] as const).map(item=><Button size=\"small\" key={item.label} label={item.label} tone={item.tone} onTap={()=>ref.current?.toggleAll(item.action)}/>)}</view><CheckboxGroup ref={ref} value={all} onChange={({value})=>setAll(value)} className=\"demo-choice-group\">{[1,2,3,4].map(name=><Checkbox key={name} name={name} disabled={name===3}>{`多选 ${name}${name===3?'(Disabled)':''}`}</Checkbox>)}</CheckboxGroup></ExampleBlock></DemoGroup></view>;}\n","props":[{"name":"type","type":"ChoiceType","optional":true,"description":"类型","values":["dot","circle","square","button"]},{"name":"checkedColor","type":"string","optional":true,"description":"选中颜色"},{"name":"uncheckedColor","type":"string","optional":true,"description":"未选中颜色"},{"name":"disabled","type":"boolean | null","optional":true,"description":"是否禁用"},{"name":"readonly","type":"boolean | null","optional":true,"description":"是否只读"},{"name":"placement","type":"'left' | 'right'","optional":true,"description":"浮层相对触发元素的位置","values":["left","right"]},{"name":"direction","type":"'horizontal' | 'vertical'","optional":true,"description":"布局或展开方向","values":["vertical","horizontal"]},{"name":"size","type":"'large'","optional":true,"description":"尺寸","values":["large"]},{"name":"maxWidth","type":"string","optional":true,"description":"最大宽度"},{"name":"labelClassName","type":"string","optional":true,"description":"选项文字类名"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"value","type":"readonly ChoiceValue[]","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"readonly ChoiceValue[]","optional":true,"description":"非受控模式的初始值"},{"name":"min","type":"number","optional":true,"description":"最小值"},{"name":"max","type":"number","optional":true,"description":"最大值或数量上限"}],"events":[{"name":"onChange","type":"(event: { value: ChoiceValue[] }) => void","optional":true,"description":""}],"slots":[{"name":"renderIcon","type":"(state: { isChecked: boolean }) => ReactNode","optional":true,"description":""},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"toggle","description":"调用实例方法","type":"() => void"},{"name":"toggleAll","description":"调用实例方法","type":"(options?: boolean | { checked?: boolean; skipDisabled?: boolean }) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","独立复选框"],"title":"独立复选框","section":"组件类型","description":"通过 `value` 表示选中状态,`onChange` 返回变化后的值,子节点用于显示选项文案。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [checked, setChecked] = useState(false);\n\n<Checkbox\n value={checked}\n onChange={(event) => {\n 'background only';\n setChecked(Boolean(event.value));\n }}\n>\n 我已阅读并同意协议\n</Checkbox>\n"}]},{"name":"demo-2","aliases":["demo-2","复选框组"],"title":"复选框组","section":"组合用法","description":"在 `CheckboxGroup` 中组合多个选项,`defaultValue` 设置默认选中的值列表。","language":"tsx","code":"<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n","blocks":[{"language":"tsx","code":"<CheckboxGroup defaultValue={['apple']}>\n <Checkbox value=\"apple\">苹果</Checkbox>\n <Checkbox value=\"orange\">橙子</Checkbox>\n</CheckboxGroup>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用与按钮样式"],"title":"禁用与按钮样式","section":"组件状态","description":"设置 `disabled` 禁用选项,设置分组的 `type=\"button\"` 使用按钮外观。","language":"tsx","code":"<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n","blocks":[{"language":"tsx","code":"<Checkbox disabled>禁用选项</Checkbox>\n<CheckboxGroup type=\"button\">\n <Checkbox value=\"one\">选项一</Checkbox>\n <Checkbox value=\"two\">选项二</Checkbox>\n</CheckboxGroup>\n"}]}],"allowUnknownProps":false},{"name":"Circle","id":"circle","label":"Circle 环形进度条","category":"反馈","categoryId":"feedback","kind":"component","description":"环形进度条用于展示完成比例,支持颜色、线宽、动画和自定义中间内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Circle.tsx","docPath":"docs/ui/components/circle.md","doc":"# Circle 环形进度条\n\n环形进度条用于展示完成比例,支持颜色、线宽、动画和自定义中间内容。\n\n```tsx\nimport { Circle } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 显示进度\n\n通过 `value` 设置当前完成比例。\n\n```tsx\n<Circle value={60} />\n```\n\n## 组件样式\n\n### 自定义颜色与内容\n\n通过 `color` 设置进度颜色,子节点用于自定义环形中央的内容。\n\n```tsx\n<Circle value={75} color=\"#12b886\">\n <text>75%</text>\n</Circle>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 目标百分比;裁剪至 0–100,NaN/Infinity 按 0 处理 | `number` | `0` |\n| size | 圆环直径,px,有限非负数 | `number` | `120` |\n| color | 颜色或只读渐变对象;键支持 `0` / `100` / `0%` / `100%`,按数值排序 | `CircleColor` | `'#1c64fd'` |\n| layerColor | 轨道颜色 | `string` | `'#f2f3f5'` |\n| fill | 圆环内部填充,默认透明 | `string` | — |\n| speed | 每秒变化的百分比;≤0 或 >1000 时立即绘制,非法值回退 50 | `number` | `50` |\n| text | 中心文字,非空时优先于 children | `string` | — |\n| strokeWidth | 描边规则:前景实际描边为此值的一半;无 fill 时轨道同宽,有 fill 时轨道为完整此值 | `number` | `18` |\n| strokeLinecap | round / butt / square | `'round' \\| 'butt' \\| 'square'` | `'round'` |\n| clockwise | 是否顺时针从十二点方向展开 | `boolean` | `true` |\n| children | 中心内容插槽,不传 text 时展示 | `ReactNode` | — |\n| className | 根节点类名和样式;尺寸用 size 同步绘图几何 | `string` | `''` |\n| style | 根节点类名和样式;尺寸用 size 同步绘图几何 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 中心内容插槽,不传 text 时展示 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type CircleColor = string | Readonly<Record<string, string>>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Circle 组件源码](./sources/circle/Circle.tsx.txt) · [示例源码](./sources/circle/demo.tsx.txt) · [文档源码](./sources/circle/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Circle, Dialog, useDialog } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst gradient = { '0': '#f14646', '100': '#ffffff' };\nexport function CircleExample() {\n const [value,setValue] = useState(20), dialog = useDialog();\n return <view className=\"demo-circle-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-circle-grid\"><Circle value={value} text={`${value}%`} /><Circle value={value} color=\"#f57f00\" text={`${value}%`} /><Circle value={value} color=\"#f14646\" text={`${value}%`} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"样式定制\"><view className=\"demo-circle-grid\"><Circle value={value} strokeWidth={6} text=\"宽度定制\" /><Circle value={value} layerColor=\"#f2f3f5\" color=\"#f14646\" text=\"颜色定制\" /><Circle value={value} color={gradient} text=\"渐变色\" /><Circle value={value} color=\"#12b886\" clockwise={false} text=\"逆时针\" /><Circle value={value} size={120} text=\"大小定制\" /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"使用slot\"><view className=\"demo-circle-grid\"><Circle value={value} strokeWidth={6}><text className=\"demo-circle-value\">{`${value}%`}</text></Circle></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"进度控制\"><view className=\"demo-circle-actions\"><Button size=\"small\" label=\"增加\" onTap={() => { 'background only'; setValue(value => Math.min(100,value+10)); }} /><Button size=\"small\" tone=\"danger\" label=\"减少\" onTap={() => { 'background only'; setValue(value => Math.max(0,value-10)); }} /></view></ExampleBlock><ExampleBlock title=\"alert 验证层级\"><view className=\"demo-circle-actions\"><Button label=\"alert\" onTap={() => { 'background only'; void dialog.alert('操作成功'); }} /></view></ExampleBlock></DemoGroup>\n <Dialog {...dialog.props} />\n </view>;\n}\n","props":[{"name":"value","type":"number","optional":true,"description":"目标百分比;裁剪至 0–100,NaN/Infinity 按 0 处理","defaultValue":"0"},{"name":"size","type":"number","optional":true,"description":"圆环直径,px,有限非负数","defaultValue":"120"},{"name":"color","type":"CircleColor","optional":true,"description":"颜色或只读渐变对象;键支持 0 / 100 / 0% / 100%,按数值排序","defaultValue":"'#1c64fd'"},{"name":"layerColor","type":"string","optional":true,"description":"轨道颜色","defaultValue":"'#f2f3f5'"},{"name":"fill","type":"string","optional":true,"description":"圆环内部填充,默认透明"},{"name":"speed","type":"number","optional":true,"description":"每秒变化的百分比;≤0 或 >1000 时立即绘制,非法值回退 50","defaultValue":"50"},{"name":"text","type":"string","optional":true,"description":"中心文字,非空时优先于 children"},{"name":"strokeWidth","type":"number","optional":true,"description":"描边规则:前景实际描边为此值的一半;无 fill 时轨道同宽,有 fill 时轨道为完整此值","defaultValue":"18"},{"name":"strokeLinecap","type":"'round' | 'butt' | 'square'","optional":true,"description":"round / butt / square","defaultValue":"'round'","values":["square","round","butt"]},{"name":"clockwise","type":"boolean","optional":true,"description":"是否顺时针从十二点方向展开","defaultValue":"true","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点类名和样式;尺寸用 size 同步绘图几何","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点类名和样式;尺寸用 size 同步绘图几何"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"中心内容插槽,不传 text 时展示"}],"methods":[],"cssVars":[{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","显示进度"],"title":"显示进度","section":"基础用法","description":"通过 `value` 设置当前完成比例。","language":"tsx","code":"<Circle value={60} />\n","blocks":[{"language":"tsx","code":"<Circle value={60} />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义颜色与内容"],"title":"自定义颜色与内容","section":"组件样式","description":"通过 `color` 设置进度颜色,子节点用于自定义环形中央的内容。","language":"tsx","code":"<Circle value={75} color=\"#12b886\">\n <text>75%</text>\n</Circle>\n","blocks":[{"language":"tsx","code":"<Circle value={75} color=\"#12b886\">\n <text>75%</text>\n</Circle>\n"}]}],"allowUnknownProps":false},{"name":"Col","id":"layout","label":"Layout 布局","category":"基础","categoryId":"basic","kind":"component","description":"栅格布局将一行划分为 24 份,通过 Row 与 Col 组合控制宽度、间隔、偏移和对齐。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Layout.tsx","docPath":"docs/ui/components/layout.md","doc":"# Layout 布局\n\n栅格布局将一行划分为 24 份,通过 Row 与 Col 组合控制宽度、间隔、偏移和对齐。\n\n```tsx\nimport { Row, Col } from 'daisu-ui';\n```\n\n## 布局能力\n\n### 基础分栏\n\n栅格将一行分为 24 份,通过 `Col.span` 设置每列占用的份数。\n\n```tsx\n<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n```\n\n### 间隔与偏移\n\n通过 `Row.gutter` 设置列间距,通过 `Col.offset` 设置左侧偏移份数。\n\n```tsx\n<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n```\n\n### 水平与垂直对齐\n\n通过 `justify` 设置水平排列方式,通过 `align` 设置垂直对齐方式。\n\n```tsx\n<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n```\n\n## Attributes 属性\n\n### Row\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| gutter | 栅格列间隔,单位 px | `number` | `0` |\n| justify | 水平方向排列方式 | `keyof typeof justifyValues` | `'start'` |\n| align | 对齐方式 | `keyof typeof alignValues` | `'top'` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n### Col\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| span | 占用的栅格份数 | `number` | `24` |\n| offset | 相对目标元素的偏移 | `number` | `0` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Row.children | 自定义内容 | ReactNode |\n| Col.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Row 组件源码](./sources/layout/Layout.tsx.txt) · [Col 组件源码](./sources/layout/Layout.tsx.txt) · [示例源码](./sources/layout/demo.tsx.txt) · [文档源码](./sources/layout/docs.md.txt)\n","demoSource":"import { Col, Row } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction LayoutCell({ label, tone = 'strong', height = 30 }: { label: string; tone?: 'primary' | 'strong' | 'light'; height?: number }) {\n return <view className={`demo-layout-cell demo-layout-cell-${tone}`} style={{ height: `${height}px` }}><text>{label}</text></view>;\n}\n\nexport function LayoutExample() {\n return <view className=\"demo-layout-page\"><DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"基础用法\">\n <Row><Col><LayoutCell label=\"span: 24\" tone=\"primary\" /></Col></Row>\n {[12, 8, 6].map(span => <Row key={span}>{Array.from({ length: 24 / span }, (_, index) => <Col key={index} span={span}><LayoutCell label={`span: ${span}`} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}\n </ExampleBlock>\n <ExampleBlock title=\"分栏偏移\">\n <Row><Col span={4}><LayoutCell label=\"span: 4\" /></Col><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" tone=\"light\" /></Col></Row>\n <Row><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" /></Col><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" tone=\"light\" /></Col></Row>\n </ExampleBlock>\n <ExampleBlock title=\"分栏间隔\"><Row gutter={20}>{[0, 1, 2].map(index => <Col key={index} span={8}><LayoutCell label=\"span: 8\" tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row></ExampleBlock>\n <ExampleBlock title=\"Justify 对齐\">{(['center', 'end', 'space-between', 'space-around'] as const).map(justify => <Row key={justify} justify={justify}>{[0, 1, 2].map(index => <Col key={index} span={6}><LayoutCell label={justify.replace('space-', '')} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}</ExampleBlock>\n <ExampleBlock title=\"Align 对齐\">{(['middle', 'bottom'] as const).map(align => <Row key={align} align={align}>{[60, 30, 50].map((height, index) => <Col key={height} span={8}><LayoutCell label={align} height={height} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}</ExampleBlock>\n </DemoGroup></view>;\n}\n","props":[{"name":"span","type":"number","optional":true,"description":"占用的栅格份数","defaultValue":"24"},{"name":"offset","type":"number","optional":true,"description":"相对目标元素的偏移","defaultValue":"0"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","基础分栏"],"title":"基础分栏","section":"布局能力","description":"栅格将一行分为 24 份,通过 `Col.span` 设置每列占用的份数。","language":"tsx","code":"<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n"}]},{"name":"demo-2","aliases":["demo-2","间隔与偏移"],"title":"间隔与偏移","section":"布局能力","description":"通过 `Row.gutter` 设置列间距,通过 `Col.offset` 设置左侧偏移份数。","language":"tsx","code":"<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n"}]},{"name":"demo-3","aliases":["demo-3","水平与垂直对齐"],"title":"水平与垂直对齐","section":"布局能力","description":"通过 `justify` 设置水平排列方式,通过 `align` 设置垂直对齐方式。","language":"tsx","code":"<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n"}]}],"allowUnknownProps":false},{"name":"Collapse","id":"collapse","label":"Collapse 折叠面板","category":"数据展示","categoryId":"display","kind":"component","description":"折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Collapse.tsx","docPath":"docs/ui/components/collapse.md","doc":"# Collapse 折叠面板\n\n折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。\n\n```tsx\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 多项展开\n\n通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。\n\n```tsx\n<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 交互模式\n\n### 手风琴\n\n设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。\n\n```tsx\n<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 组件状态\n\n### 禁用选项\n\n在面板项上设置 `disabled`,该项不能展开。\n\n```tsx\n<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n```\n\n## 内容形态\n\n### 查看更多\n\n通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。\n\n```tsx\n<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n```\n\n## Attributes 属性\n\n### Collapse\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 数据项配置 | `CollapseItemData[]` | 必填 |\n| value | 当前值;传入后由调用方更新 | `string[]` | — |\n| defaultValue | 非受控模式的初始值 | `string[]` | `[]` |\n| accordion | 是否每次只展开一项 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n\n### CollapseViewMore\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `string` | 必填 |\n| value | 当前值;传入后由调用方更新 | `boolean` | — |\n| defaultValue | 非受控模式的初始值 | `boolean` | `false` |\n| lineCount | lineCount 配置 | `number` | `2` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Collapse.onChange | 值发生变化时触发 | (value: string[]) => void |\n| CollapseViewMore.onChange | 值发生变化时触发 | (value: boolean) => void |\n\n## 数据类型\n\n```tsx\nexport type CollapseItemData = {\n name: string;\n title: string;\n content: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n beforeExpand?: (name: string) => boolean | Promise<boolean>;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Collapse 组件源码](./sources/collapse/Collapse.tsx.txt) · [CollapseViewMore 组件源码](./sources/collapse/Collapse.tsx.txt) · [示例源码](./sources/collapse/demo.tsx.txt) · [文档源码](./sources/collapse/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst text = '这是一条简单的示例文字。';\nconst content = <text className=\"demo-collapse-copy\">{text}</text>;\n\nexport function CollapseExample() {\n const [open, setOpen] = useState<string[]>(['first']);\n const [accordion, setAccordion] = useState<string[]>(['one']);\n const change = (value: string[]) => { 'background only'; setOpen(value); };\n const changeAccordion = (value: string[]) => { 'background only'; setAccordion(value); };\n return <>\n <DemoGroup title=\"基本用法\"><ExampleBlock title=\"普通折叠\" noPadding><Collapse value={open} onChange={change} items={[{ name: 'first', title: '标签1', content }, { name: 'second', title: '标签2', content }, { name: 'third', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\" noPadding><Collapse defaultValue={['one']} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', disabled: true, content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"交互模式\">\n <ExampleBlock title=\"手风琴\" noPadding><Collapse value={accordion} accordion onChange={changeAccordion} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock>\n <ExampleBlock title=\"异步展开\" noPadding><Collapse items={[{ name: 'async', title: '点击加载内容', beforeExpand: () => new Promise(resolve => setTimeout(() => resolve(true), 500)), content: <text className=\"demo-collapse-copy\">内容加载完成后展开。</text> }]} /></ExampleBlock>\n <ExampleBlock title=\"查看更多\"><CollapseViewMore text={text.repeat(12)} lineCount={2} /></ExampleBlock>\n </DemoGroup>\n </>;\n}\n","props":[{"name":"items","type":"CollapseItemData[]","optional":false,"description":"数据项配置","defaultValue":"必填"},{"name":"value","type":"string[]","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"string[]","optional":true,"description":"非受控模式的初始值","defaultValue":"[]"},{"name":"accordion","type":"boolean","optional":true,"description":"是否每次只展开一项","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[{"name":"onChange","type":"(value: string[]) => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","多项展开"],"title":"多项展开","section":"基础用法","description":"通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。","language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","手风琴"],"title":"手风琴","section":"交互模式","description":"设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。","language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用选项"],"title":"禁用选项","section":"组件状态","description":"在面板项上设置 `disabled`,该项不能展开。","language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n"}]},{"name":"demo-4","aliases":["demo-4","查看更多"],"title":"查看更多","section":"内容形态","description":"通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。","language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n","blocks":[{"language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n"}]}],"allowUnknownProps":false},{"name":"CollapseItem","id":"collapse","label":"Collapse 折叠面板","category":"数据展示","categoryId":"display","kind":"component","description":"折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Collapse.tsx","docPath":"docs/ui/components/collapse.md","doc":"# Collapse 折叠面板\n\n折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。\n\n```tsx\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 多项展开\n\n通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。\n\n```tsx\n<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 交互模式\n\n### 手风琴\n\n设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。\n\n```tsx\n<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 组件状态\n\n### 禁用选项\n\n在面板项上设置 `disabled`,该项不能展开。\n\n```tsx\n<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n```\n\n## 内容形态\n\n### 查看更多\n\n通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。\n\n```tsx\n<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n```\n\n## Attributes 属性\n\n### Collapse\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 数据项配置 | `CollapseItemData[]` | 必填 |\n| value | 当前值;传入后由调用方更新 | `string[]` | — |\n| defaultValue | 非受控模式的初始值 | `string[]` | `[]` |\n| accordion | 是否每次只展开一项 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n\n### CollapseViewMore\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `string` | 必填 |\n| value | 当前值;传入后由调用方更新 | `boolean` | — |\n| defaultValue | 非受控模式的初始值 | `boolean` | `false` |\n| lineCount | lineCount 配置 | `number` | `2` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Collapse.onChange | 值发生变化时触发 | (value: string[]) => void |\n| CollapseViewMore.onChange | 值发生变化时触发 | (value: boolean) => void |\n\n## 数据类型\n\n```tsx\nexport type CollapseItemData = {\n name: string;\n title: string;\n content: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n beforeExpand?: (name: string) => boolean | Promise<boolean>;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Collapse 组件源码](./sources/collapse/Collapse.tsx.txt) · [CollapseViewMore 组件源码](./sources/collapse/Collapse.tsx.txt) · [示例源码](./sources/collapse/demo.tsx.txt) · [文档源码](./sources/collapse/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst text = '这是一条简单的示例文字。';\nconst content = <text className=\"demo-collapse-copy\">{text}</text>;\n\nexport function CollapseExample() {\n const [open, setOpen] = useState<string[]>(['first']);\n const [accordion, setAccordion] = useState<string[]>(['one']);\n const change = (value: string[]) => { 'background only'; setOpen(value); };\n const changeAccordion = (value: string[]) => { 'background only'; setAccordion(value); };\n return <>\n <DemoGroup title=\"基本用法\"><ExampleBlock title=\"普通折叠\" noPadding><Collapse value={open} onChange={change} items={[{ name: 'first', title: '标签1', content }, { name: 'second', title: '标签2', content }, { name: 'third', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\" noPadding><Collapse defaultValue={['one']} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', disabled: true, content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"交互模式\">\n <ExampleBlock title=\"手风琴\" noPadding><Collapse value={accordion} accordion onChange={changeAccordion} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock>\n <ExampleBlock title=\"异步展开\" noPadding><Collapse items={[{ name: 'async', title: '点击加载内容', beforeExpand: () => new Promise(resolve => setTimeout(() => resolve(true), 500)), content: <text className=\"demo-collapse-copy\">内容加载完成后展开。</text> }]} /></ExampleBlock>\n <ExampleBlock title=\"查看更多\"><CollapseViewMore text={text.repeat(12)} lineCount={2} /></ExampleBlock>\n </DemoGroup>\n </>;\n}\n","props":[{"name":"name","type":"string","optional":false,"description":""},{"name":"title","type":"string","optional":false,"description":""},{"name":"content","type":"ReactNode","optional":false,"description":""},{"name":"icon","type":"ReactNode","optional":true,"description":""},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"beforeExpand","type":"(name: string) => boolean | Promise<boolean>","optional":true,"description":""},{"name":"expanded","type":"boolean","optional":false,"description":"","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]}],"events":[{"name":"onToggle","type":"() => void","optional":false,"description":""}],"slots":[{"name":"content","type":"ReactNode","optional":false,"description":""},{"name":"icon","type":"ReactNode","optional":true,"description":""}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","多项展开"],"title":"多项展开","section":"基础用法","description":"通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。","language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","手风琴"],"title":"手风琴","section":"交互模式","description":"设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。","language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用选项"],"title":"禁用选项","section":"组件状态","description":"在面板项上设置 `disabled`,该项不能展开。","language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n"}]},{"name":"demo-4","aliases":["demo-4","查看更多"],"title":"查看更多","section":"内容形态","description":"通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。","language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n","blocks":[{"language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n"}]}],"allowUnknownProps":false},{"name":"CollapseViewMore","id":"collapse","label":"Collapse 折叠面板","category":"数据展示","categoryId":"display","kind":"component","description":"折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Collapse.tsx","docPath":"docs/ui/components/collapse.md","doc":"# Collapse 折叠面板\n\n折叠面板用于展开或收起分组内容,支持多项展开、手风琴和异步展开校验。\n\n```tsx\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 多项展开\n\n通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。\n\n```tsx\n<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 交互模式\n\n### 手风琴\n\n设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。\n\n```tsx\n<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n```\n\n## 组件状态\n\n### 禁用选项\n\n在面板项上设置 `disabled`,该项不能展开。\n\n```tsx\n<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n```\n\n## 内容形态\n\n### 查看更多\n\n通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。\n\n```tsx\n<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n```\n\n## Attributes 属性\n\n### Collapse\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 数据项配置 | `CollapseItemData[]` | 必填 |\n| value | 当前值;传入后由调用方更新 | `string[]` | — |\n| defaultValue | 非受控模式的初始值 | `string[]` | `[]` |\n| accordion | 是否每次只展开一项 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n\n### CollapseViewMore\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `string` | 必填 |\n| value | 当前值;传入后由调用方更新 | `boolean` | — |\n| defaultValue | 非受控模式的初始值 | `boolean` | `false` |\n| lineCount | lineCount 配置 | `number` | `2` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Collapse.onChange | 值发生变化时触发 | (value: string[]) => void |\n| CollapseViewMore.onChange | 值发生变化时触发 | (value: boolean) => void |\n\n## 数据类型\n\n```tsx\nexport type CollapseItemData = {\n name: string;\n title: string;\n content: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n beforeExpand?: (name: string) => boolean | Promise<boolean>;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Collapse 组件源码](./sources/collapse/Collapse.tsx.txt) · [CollapseViewMore 组件源码](./sources/collapse/Collapse.tsx.txt) · [示例源码](./sources/collapse/demo.tsx.txt) · [文档源码](./sources/collapse/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Collapse, CollapseViewMore } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst text = '这是一条简单的示例文字。';\nconst content = <text className=\"demo-collapse-copy\">{text}</text>;\n\nexport function CollapseExample() {\n const [open, setOpen] = useState<string[]>(['first']);\n const [accordion, setAccordion] = useState<string[]>(['one']);\n const change = (value: string[]) => { 'background only'; setOpen(value); };\n const changeAccordion = (value: string[]) => { 'background only'; setAccordion(value); };\n return <>\n <DemoGroup title=\"基本用法\"><ExampleBlock title=\"普通折叠\" noPadding><Collapse value={open} onChange={change} items={[{ name: 'first', title: '标签1', content }, { name: 'second', title: '标签2', content }, { name: 'third', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\" noPadding><Collapse defaultValue={['one']} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', disabled: true, content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"交互模式\">\n <ExampleBlock title=\"手风琴\" noPadding><Collapse value={accordion} accordion onChange={changeAccordion} items={[{ name: 'one', title: '标签1', content }, { name: 'two', title: '标签2', content }, { name: 'three', title: '标签3', content }]} /></ExampleBlock>\n <ExampleBlock title=\"异步展开\" noPadding><Collapse items={[{ name: 'async', title: '点击加载内容', beforeExpand: () => new Promise(resolve => setTimeout(() => resolve(true), 500)), content: <text className=\"demo-collapse-copy\">内容加载完成后展开。</text> }]} /></ExampleBlock>\n <ExampleBlock title=\"查看更多\"><CollapseViewMore text={text.repeat(12)} lineCount={2} /></ExampleBlock>\n </DemoGroup>\n </>;\n}\n","props":[{"name":"text","type":"string","optional":false,"description":"显示文字","defaultValue":"必填"},{"name":"value","type":"boolean","optional":true,"description":"当前值;传入后由调用方更新","values":[false,true]},{"name":"defaultValue","type":"boolean","optional":true,"description":"非受控模式的初始值","defaultValue":"false","values":[false,true]},{"name":"lineCount","type":"number","optional":true,"description":"lineCount 配置","defaultValue":"2"}],"events":[{"name":"onChange","type":"(value: boolean) => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","多项展开"],"title":"多项展开","section":"基础用法","description":"通过 `items` 配置面板,每项的 `name` 标识面板,`title` 设置标题,`content` 设置内容。","language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","手风琴"],"title":"手风琴","section":"交互模式","description":"设置 `accordion` 后每次只展开一项,`defaultValue` 指定默认展开项。","language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n accordion\n defaultValue={['one']}\n items={[\n { name: 'one', title: '标题一', content: <text>内容一</text> },\n { name: 'two', title: '标题二', content: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用选项"],"title":"禁用选项","section":"组件状态","description":"在面板项上设置 `disabled`,该项不能展开。","language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Collapse\n items={[\n {\n name: 'one',\n title: '禁用面板',\n disabled: true,\n content: <text>内容</text>,\n },\n ]}\n/>\n"}]},{"name":"demo-4","aliases":["demo-4","查看更多"],"title":"查看更多","section":"内容形态","description":"通过 `text` 设置长文案,通过 `lineCount` 指定折叠时显示的行数。","language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n","blocks":[{"language":"tsx","code":"<CollapseViewMore\n text=\"这是一段较长的说明文字,可以在折叠状态下展示摘要,并通过查看更多展开全部内容。\"\n lineCount={2}\n/>\n"}]}],"allowUnknownProps":false},{"name":"ConfigProvider","id":"config-provider","label":"ConfigProvider 全局配置","category":"基础","categoryId":"basic","kind":"component","description":"全局配置用于统一组件的明暗主题、颜色变量和默认属性,也可以在局部嵌套覆盖。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/ConfigProvider.tsx","docPath":"docs/ui/components/config-provider.md","doc":"# ConfigProvider 全局配置\n\n全局配置用于统一组件的明暗主题、颜色变量和默认属性,也可以在局部嵌套覆盖。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n```\n\n## 主题模式\n\n### 明暗切换\n\n通过 `theme` 在 `light` 与 `dark` 之间切换,内部组件跟随当前主题。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [dark, setDark] = useState(false);\n\n<ConfigProvider theme={dark ? 'dark' : 'light'}>\n <Button\n label=\"切换主题\"\n onTap={() => {\n 'background only';\n setDark(!dark);\n }}\n />\n</ConfigProvider>\n```\n\n## 组件样式\n\n### 颜色与组件默认值\n\n通过 `themeVars` 覆盖主题变量,通过 `button` 设置按钮的默认属性。\n\n```tsx\n<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| theme | 外观主题 | `ConfigProviderTheme` | — |\n| themeVars | 主题变量覆盖值 | `ConfigProviderThemeVars` | — |\n| button | 按钮默认属性 | `ConfigButtonDefaults` | — |\n| tag | 标签默认属性 | `ConfigTagDefaults` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ConfigProviderTheme = 'light' | 'dark';\n\nexport type ConfigProviderThemeVars = Partial<\n Record<\n | 'primary'\n | 'onPrimary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'info'\n | 'canvas'\n | 'surface'\n | 'surfaceMuted'\n | 'text'\n | 'textMuted'\n | 'line'\n | 'colorTheme'\n | 'buttonPrimaryBg'\n | 'buttonPrimaryBgColor'\n | 'buttonPrimaryColor'\n | 'buttonHeight'\n | 'buttonRadius'\n | 'buttonFontSize'\n | 'cellTitleColor',\n string | number\n >\n> & { [key: `--cso-ui-${string}`]: string | number | undefined };\n\nexport type ConfigButtonDefaults = Pick<\n ButtonProps,\n 'size' | 'tone' | 'round'\n> & { variant?: ButtonProps['variant'] | 'base'; type?: ButtonProps['tone'] };\n\nexport type ConfigTagDefaults = Pick<TagProps, 'size' | 'variant' | 'round'>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-avatar-bg` | 共享主题 |\n| `--cso-ui-avatar-collapse-bg` | 共享主题 |\n| `--cso-ui-avatar-collapse-color` | 共享主题 |\n| `--cso-ui-avatar-text` | 共享主题 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-picker-fade-bottom` | 共享主题 |\n| `--cso-ui-picker-fade-top` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-tag-default-color` | 共享主题 |\n| `--cso-ui-tag-light-cyan-bg` | 共享主题 |\n| `--cso-ui-tag-light-danger-bg` | 共享主题 |\n| `--cso-ui-tag-light-default-bg` | 共享主题 |\n| `--cso-ui-tag-light-lightblue-bg` | 共享主题 |\n| `--cso-ui-tag-light-pink-bg` | 共享主题 |\n| `--cso-ui-tag-light-primary-bg` | 共享主题 |\n| `--cso-ui-tag-light-purple-bg` | 共享主题 |\n| `--cso-ui-tag-light-success-bg` | 共享主题 |\n| `--cso-ui-tag-light-volcano-bg` | 共享主题 |\n| `--cso-ui-tag-light-warning-bg` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[ConfigProvider 组件源码](./sources/config-provider/ConfigProvider.tsx.txt) · [示例源码](./sources/config-provider/demo.tsx.txt) · [文档源码](./sources/config-provider/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, ConfigProvider, Popup, Radio, RadioGroup, Switch, Tag } from 'daisu-ui';\nimport type { ConfigButtonDefaults, ConfigTagDefaults } from 'daisu-ui';\nimport type { HostClient } from '../../../lib/host.js';\nimport { ComplexFormExample } from './form-complex.js';\nimport { DemoGroup } from './shared.js';\n\nconst options = {\n buttonSize:['unset','mini','small','medium','large'], buttonVariant:['unset','base','plain','dashed','soft','text'], buttonType:['unset','primary','success','info','warning','danger'],\n tagSize:['unset','small','medium','large','extra-large','default'], tagVariant:['unset','light','dark','plain','dashed','text'],\n} as const;\nexport function ConfigProviderExample({ host }: { host?: HostClient | null }) {\n const [settings,setSettings] = useState<Record<keyof typeof options,string>>({buttonSize:'unset',buttonVariant:'unset',buttonType:'unset',tagSize:'unset',tagVariant:'unset'});\n const [buttonRound,setButtonRound] = useState(false), [tagRound,setTagRound] = useState(false), [show,setShow] = useState(false);\n const button: ConfigButtonDefaults = { ...(settings.buttonSize==='unset'?{}:{size:settings.buttonSize as ConfigButtonDefaults['size']}), ...(settings.buttonVariant==='unset'?{}:{variant:settings.buttonVariant as ConfigButtonDefaults['variant']}), ...(settings.buttonType==='unset'?{}:{type:settings.buttonType as ConfigButtonDefaults['type']}), ...(buttonRound?{round:true}:{}) };\n const tag: ConfigTagDefaults = { ...(settings.tagSize==='unset'?{}:{size:settings.tagSize as ConfigTagDefaults['size']}), ...(settings.tagVariant==='unset'?{}:{variant:settings.tagVariant as ConfigTagDefaults['variant']}), ...(tagRound?{round:true}:{}) };\n const config = { ...(Object.keys(button).length?{button}:{}), ...(Object.keys(tag).length?{tag}:{}) };\n const control = (name: keyof typeof options, title: string) => <Cell key={name} title={title} titleWidth=\"18.666667vw\" center>\n <RadioGroup<string> type=\"button\" direction=\"horizontal\" className=\"demo-config-choices\" value={settings[name]} onChange={value => { 'background only'; if(value) setSettings(previous=>({...previous,[name]:value})); }}>\n {options[name].map(value=><Radio key={value} value={value}>{value}</Radio>)}\n </RadioGroup>\n </Cell>;\n return <view className=\"demo-config-provider-page\">\n <DemoGroup title=\"全局配置 Playground\">\n <CellGroup title=\"控制面板\" border>\n {control('buttonSize','Button.size')}{control('buttonVariant','Button.variant')}{control('buttonType','Button.type')}\n <Cell title=\"Button.round\" titleWidth=\"18.666667vw\" center><Switch className=\"demo-config-switch\" size={20} value={buttonRound} onChange={({value})=>setButtonRound(!!value)} /></Cell>\n {control('tagSize','Tag.size')}{control('tagVariant','Tag.variant')}\n <Cell title=\"Tag.round\" titleWidth=\"18.666667vw\" center><Switch className=\"demo-config-switch\" size={20} value={tagRound} onChange={({value})=>setTagRound(!!value)} /></Cell>\n </CellGroup>\n <ConfigProvider {...config}>\n <CellGroup title=\"实时预览\" border>\n <Cell title=\"按钮\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"primary\"/><Button tone=\"success\" label=\"success\"/><Button tone=\"info\" label=\"info\"/></view></Cell>\n <Cell title=\"标签\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Tag>default</Tag><Tag type=\"primary\">primary</Tag><Tag type=\"success\">success</Tag></view></Cell>\n <Cell title=\"root-portal 穿透测试\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"打开 popup\" onTap={()=>setShow(true)}/></view></Cell>\n </CellGroup>\n <Popup show={show} onChange={setShow} position=\"bottom\" rootPortal closable className=\"ui-demo-page\"><view className=\"demo-config-popup-content\"><text className=\"demo-config-preview-label\">popup 内</text><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"button\"/><Tag type=\"primary\">tag</Tag></view><Button tone=\"info\" variant=\"plain\" block label=\"关闭\" onTap={()=>setShow(false)}/></view></Popup>\n </ConfigProvider>\n <CellGroup title=\"当前生效配置\" border><text className=\"demo-config-json\">{JSON.stringify(config,null,2)}</text></CellGroup>\n </DemoGroup>\n <DemoGroup title=\"表单示例\"><ComplexFormExample host={host}/></DemoGroup>\n </view>;\n}\n","props":[{"name":"theme","type":"ConfigProviderTheme","optional":true,"description":"外观主题","values":["light","dark"]},{"name":"themeVars","type":"ConfigProviderThemeVars","optional":true,"description":"主题变量覆盖值"},{"name":"button","type":"ConfigButtonDefaults","optional":true,"description":"按钮默认属性"},{"name":"tag","type":"ConfigTagDefaults","optional":true,"description":"标签默认属性"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-avatar-bg","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-avatar-collapse-bg","defaultValue":"#ebedf0","description":""},{"name":"--cso-ui-avatar-collapse-color","defaultValue":"#969799","description":""},{"name":"--cso-ui-avatar-text","defaultValue":"var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted))","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-picker-fade-bottom","defaultValue":"linear-gradient(180deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-picker-fade-top","defaultValue":"linear-gradient(0deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-tag-default-color","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-tag-light-cyan-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-danger-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-default-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-lightblue-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-pink-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-primary-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-purple-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-success-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-volcano-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-warning-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","颜色与组件默认值"],"title":"颜色与组件默认值","section":"组件样式","description":"通过 `themeVars` 覆盖主题变量,通过 `button` 设置按钮的默认属性。","language":"tsx","code":"<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n","blocks":[{"language":"tsx","code":"<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n"}]}],"allowUnknownProps":false},{"name":"connectRouterHistory","id":"connect-router-history","label":"connectRouterHistory","category":"公共 API","categoryId":"api","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/core.ts","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","props":[{"name":"engine","type":"TanStackRouter<AnyRoute, \"never\", false, import(\"@tanstack/history\").RouterHistory, Record<string, any>>","optional":false,"description":"Diagnostic/advanced TanStack access. Route changes must use the guarded facade."},{"name":"navigate","type":"<const TTo extends string | undefined, const TFrom extends string = string>(navigation: SceneNavigateOptions<AnyRoute, TTo, TFrom>) => Promise<boolean>","optional":false,"description":""},{"name":"route","type":"R","optional":false,"description":""},{"name":"routes","type":"R[]","optional":false,"description":""},{"name":"snapshot","type":"RouterSnapshot<R>","optional":false,"description":""},{"name":"href","type":"(route: R) => string","optional":false,"description":""},{"name":"serialize","type":"RouterHistoryState","optional":false,"description":""},{"name":"whenIdle","type":"() => Promise<boolean>","optional":false,"description":"Wait for an openBusiness navigation, whose return value means \"handled\"."},{"name":"load","type":"() => Promise<boolean>","optional":false,"description":""},{"name":"push","type":"(location: string, replace?: boolean) => NavigationResult","optional":false,"description":""},{"name":"replace","type":"(location: string) => NavigationResult","optional":false,"description":""},{"name":"back","type":"NavigationResult","optional":false,"description":""},{"name":"reset","type":"NavigationResult","optional":false,"description":""},{"name":"restore","type":"NavigationResult","optional":false,"description":""},{"name":"subscribe","type":"(listener: (snapshot: RouterSnapshot<R>, navigation: Navigation<R>) => void) => () => void","optional":false,"description":""},{"name":"beforeEach","type":"(guard: NavigationGuard<R>) => () => void","optional":false,"description":""},{"name":"afterEach","type":"(listener: (navigation: Navigation<R>) => void) => () => void","optional":false,"description":""}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"CountDown","id":"count-down","label":"CountDown 倒计时","category":"反馈","categoryId":"feedback","kind":"component","description":"倒计时用于显示剩余时间,支持格式化、毫秒显示和命令式控制。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/CountDown.tsx","docPath":"docs/ui/components/count-down.md","doc":"# CountDown 倒计时\n\n倒计时用于显示剩余时间,支持格式化、毫秒显示和命令式控制。\n\n```tsx\nimport { CountDown } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 显示剩余时间\n\n通过 `time` 设置倒计时时长,单位为 ms。\n\n```tsx\n<CountDown time={3600000} />\n```\n\n## 组件样式\n\n### 自定义格式\n\n通过 `format` 指定显示格式,例如 `mm:ss` 展示分钟和秒。\n\n```tsx\n<CountDown time={90000} format=\"mm:ss\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| time | 剩余时长,单位 ms | `number` | `0` |\n| millisecond | 是否启用毫秒级更新 | `boolean` | `false` |\n| autoStart | 是否自动开始 | `boolean` | `true` |\n| format | 显示格式或是否启用格式化 | `string` | `'HH:mm:ss'` |\n| children | 自定义内容 | `ReactNode\\|((current:TimeData)=>ReactNode)` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (current:TimeData)=>void |\n| onFinish | 对应操作发生时触发 | ()=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode\\|((current:TimeData)=>ReactNode) |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| start | 调用实例方法 | ()=>void |\n| pause | 调用实例方法 | ()=>void |\n| reset | 重置状态 | ()=>void |\n\n## 数据类型\n\n```tsx\nexport type TimeData = {\n total: number;\n days: number;\n hours: number;\n minutes: number;\n seconds: number;\n milliseconds: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[CountDown 组件源码](./sources/count-down/CountDown.tsx.txt) · [示例源码](./sources/count-down/demo.tsx.txt) · [文档源码](./sources/count-down/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { CountDown, Grid, GridItem, Toast, useToast } from 'daisu-ui';\nimport type { CountDownRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst time=30*60*60*1000;\nexport function CountDownExample(){const ref=useRef<CountDownRef>(null),toast=useToast();return <view className=\"demo-count-down-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><CountDown time={time}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"自定义格式\"><CountDown time={time} format=\"DD 天 HH 时 mm 分 ss 秒\"/></ExampleBlock><ExampleBlock title=\"毫秒级渲染\"><CountDown time={time} millisecond format=\"HH:mm:ss:SS\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义样式\"><CountDown time={time}>{current=><view className=\"demo-count-down-custom\"><text className=\"demo-count-down-unit\">{current.hours}</text><text className=\"demo-count-down-colon\">:</text><text className=\"demo-count-down-unit\">{current.minutes}</text><text className=\"demo-count-down-colon\">:</text><text className=\"demo-count-down-unit\">{current.seconds}</text></view>}</CountDown></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"手动控制\"><CountDown ref={ref} time={3000} millisecond autoStart={false} format=\"ss:SSS\" onFinish={()=>{ 'background only';toast.show('倒计时结束');}}/><Grid clickable border><GridItem text=\"开始\" icon=\"play-circle\" onItemClick={()=>{ 'background only';ref.current?.start();}}/><GridItem text=\"暂停\" icon=\"pause-circle\" onItemClick={()=>{ 'background only';ref.current?.pause();}}/><GridItem text=\"重置\" icon=\"refresh\" onItemClick={()=>{ 'background only';ref.current?.reset();}}/></Grid></ExampleBlock></DemoGroup><Toast {...toast.props}/>\n</view>;}\n","props":[{"name":"time","type":"number","optional":true,"description":"剩余时长,单位 ms","defaultValue":"0"},{"name":"millisecond","type":"boolean","optional":true,"description":"是否启用毫秒级更新","defaultValue":"false","values":[false,true]},{"name":"autoStart","type":"boolean","optional":true,"description":"是否自动开始","defaultValue":"true","values":[false,true]},{"name":"format","type":"string","optional":true,"description":"显示格式或是否启用格式化","defaultValue":"'HH:mm:ss'"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(current:TimeData)=>void","optional":true,"description":"值发生变化时触发"},{"name":"onFinish","type":"()=>void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"children","type":"ReactNode|((current:TimeData)=>ReactNode)","optional":true,"description":"自定义内容"}],"methods":[{"name":"start","description":"调用实例方法","type":"()=>void"},{"name":"pause","description":"调用实例方法","type":"()=>void"},{"name":"reset","description":"重置状态","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","显示剩余时间"],"title":"显示剩余时间","section":"基础用法","description":"通过 `time` 设置倒计时时长,单位为 ms。","language":"tsx","code":"<CountDown time={3600000} />\n","blocks":[{"language":"tsx","code":"<CountDown time={3600000} />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义格式"],"title":"自定义格式","section":"组件样式","description":"通过 `format` 指定显示格式,例如 `mm:ss` 展示分钟和秒。","language":"tsx","code":"<CountDown time={90000} format=\"mm:ss\" />\n","blocks":[{"language":"tsx","code":"<CountDown time={90000} format=\"mm:ss\" />\n"}]}],"allowUnknownProps":false},{"name":"CountTo","id":"count-to","label":"CountTo 数字滚动","category":"反馈","categoryId":"feedback","kind":"component","description":"数字滚动通过补间动画展示数值变化,可用于统计数据、金额和指标。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/CountTo.tsx","docPath":"docs/ui/components/count-to.md","doc":"# CountTo 数字滚动\n\n数字滚动通过补间动画展示数值变化,可用于统计数据、金额和指标。\n\n```tsx\nimport { CountTo } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 数字动画\n\n通过 `startVal` 和 `endVal` 设置数字动画的开始值与结束值。\n\n```tsx\n<CountTo startVal={0} endVal={2026} />\n```\n\n## 组件样式\n\n### 金额格式\n\n通过 `decimals` 设置小数位数,通过 `prefix` 设置金额前缀。\n\n```tsx\n<CountTo startVal={0} endVal={12345.67} decimals={2} prefix=\"¥\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| startVal | 有限起止数,非法值按0处理,支持递减和负数 | `number` | `0` |\n| endVal | 有限起止数,非法值按0处理,支持递减和负数 | `number` | `2024` |\n| duration | 时长ms,非有限值/负数归0;0时长开始后直接显示终值 | `number` | `3000` |\n| autoStart | 自动播放;起止值、时长或此参数改变会重置 | `boolean` | `true` |\n| decimals | 小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组 | `number` | `0` |\n| decimal | 小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组 | `string` | `'.'` |\n| separator | 小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组 | `string` | `','` |\n| prefix | 前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染 | `ReactNode` | — |\n| suffix | 前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染 | `ReactNode` | — |\n| useEasing | 指数缓出,false线性;结束时精确落到endVal | `boolean` | `true` |\n| fontSize | 可选主数字字号px,配套行高为字号+8;不设置时使用18px/26px Token默认值 | `number` | — |\n| color | 显式覆盖主题颜色,含默认前后缀 | `string` | — |\n| type | default / primary / error / success / warning / info,使用语义Token | `'default'\\|'primary'\\|'error'\\|'warning'\\|'success'\\|'info'` | `'default'` |\n| children | 替换主数字,ReactNode或 `(value:number,formatted:string)=>ReactNode` | `ReactNode\\|((value:number,formatted:string)=>ReactNode)` | — |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onMounted | 组件effect挂载一次 / 本轮动画结束一次 | ()=>void |\n| onFinish | 组件effect挂载一次 / 本轮动画结束一次 | ()=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染 | ReactNode |\n| suffix | 前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染 | ReactNode |\n| children | 替换主数字,ReactNode或 `(value:number,formatted:string)=>ReactNode` | ReactNode\\|((value:number,formatted:string)=>ReactNode) |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| start | 调用实例方法 | ()=>void |\n| pause | 调用实例方法 | ()=>void |\n| reset | 重置状态 | ()=>void |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-count-to-font-size` | 当前组件 |\n| `--cso-ui-count-to-line-height` | 当前组件 |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-info` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-warning` | 共享主题 |\n\n## 源代码\n\n[CountTo 组件源码](./sources/count-to/CountTo.tsx.txt) · [示例源码](./sources/count-to/demo.tsx.txt) · [文档源码](./sources/count-to/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { CountTo, Grid, GridItem } from 'daisu-ui';\nimport type { CountToRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function CountToExample(){const ref=useRef<CountToRef>(null);return <view className=\"demo-count-to-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><CountTo endVal={2024} suffix=\"年\" color=\"var(--cso-ui-success)\"/><CountTo prefix=\"¥\" decimals={2} endVal={186.321} suffix=\"%\" color=\"var(--cso-ui-primary)\"/><CountTo prefix=\"¥\" decimals={2} endVal={21286.321} suffix=\"%\" color=\"var(--cso-ui-danger)\"/><CountTo prefix=\"¥\" decimals={2} endVal={21286.321} suffix=\"%\" color=\"var(--cso-ui-warning)\" duration={2000}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"设置主题\">{(['primary','error','success','warning','default'] as const).map(type=><CountTo key={type} type={type} prefix=\"¥\" endVal={888888} suffix=\"%\"/>)}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"手动控制\"><CountTo ref={ref} autoStart={false} prefix=\"¥\" startVal={1000} decimals={3} endVal={9999.32} suffix=\"%\" color=\"var(--cso-ui-primary)\"/><Grid clickable border><GridItem text=\"开始\" icon=\"play-circle\" onItemClick={()=>{ 'background only';ref.current?.start();}}/><GridItem text=\"暂停\" icon=\"pause-circle\" onItemClick={()=>{ 'background only';ref.current?.pause();}}/><GridItem text=\"重置\" icon=\"refresh\" onItemClick={()=>{ 'background only';ref.current?.reset();}}/></Grid></ExampleBlock></DemoGroup>\n</view>;}\n","props":[{"name":"startVal","type":"number","optional":true,"description":"有限起止数,非法值按0处理,支持递减和负数","defaultValue":"0"},{"name":"endVal","type":"number","optional":true,"description":"有限起止数,非法值按0处理,支持递减和负数","defaultValue":"2024"},{"name":"duration","type":"number","optional":true,"description":"时长ms,非有限值/负数归0;0时长开始后直接显示终值","defaultValue":"3000"},{"name":"autoStart","type":"boolean","optional":true,"description":"自动播放;起止值、时长或此参数改变会重置","defaultValue":"true","values":[false,true]},{"name":"decimals","type":"number","optional":true,"description":"小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组","defaultValue":"0"},{"name":"decimal","type":"string","optional":true,"description":"小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组","defaultValue":"'.'"},{"name":"separator","type":"string","optional":true,"description":"小数位数(裁剪为0–20整数)、小数分隔符、千分位分隔符,空separator关闭分组","defaultValue":"','"},{"name":"prefix","type":"ReactNode","optional":true,"description":"前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染"},{"name":"suffix","type":"ReactNode","optional":true,"description":"前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染"},{"name":"useEasing","type":"boolean","optional":true,"description":"指数缓出,false线性;结束时精确落到endVal","defaultValue":"true","values":[false,true]},{"name":"fontSize","type":"number","optional":true,"description":"可选主数字字号px,配套行高为字号+8;不设置时使用18px/26px Token默认值"},{"name":"color","type":"string","optional":true,"description":"显式覆盖主题颜色,含默认前后缀"},{"name":"type","type":"'default'|'primary'|'error'|'warning'|'success'|'info'","optional":true,"description":"default / primary / error / success / warning / info,使用语义Token","defaultValue":"'default'","values":["primary","success","info","warning","error","default"]},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onMounted","type":"()=>void","optional":true,"description":"组件effect挂载一次 / 本轮动画结束一次"},{"name":"onFinish","type":"()=>void","optional":true,"description":"组件effect挂载一次 / 本轮动画结束一次"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染"},{"name":"suffix","type":"ReactNode","optional":true,"description":"前后缀ReactNode;原始string/number使用12px/18px文字,其余作为插槽渲染"},{"name":"children","type":"ReactNode|((value:number,formatted:string)=>ReactNode)","optional":true,"description":"替换主数字,ReactNode或 (value:number,formatted:string)=>ReactNode"}],"methods":[{"name":"start","description":"调用实例方法","type":"()=>void"},{"name":"pause","description":"调用实例方法","type":"()=>void"},{"name":"reset","description":"重置状态","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-count-to-font-size","defaultValue":"18px","description":""},{"name":"--cso-ui-count-to-line-height","defaultValue":"26px","description":""},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-info","description":"共享语义主题变量","defaultValue":"#236fd4","darkValue":"#78aeff"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"}],"demos":[{"name":"basic","aliases":["demo-1","数字动画"],"title":"数字动画","section":"基础用法","description":"通过 `startVal` 和 `endVal` 设置数字动画的开始值与结束值。","language":"tsx","code":"<CountTo startVal={0} endVal={2026} />\n","blocks":[{"language":"tsx","code":"<CountTo startVal={0} endVal={2026} />\n"}]},{"name":"demo-2","aliases":["demo-2","金额格式"],"title":"金额格式","section":"组件样式","description":"通过 `decimals` 设置小数位数,通过 `prefix` 设置金额前缀。","language":"tsx","code":"<CountTo startVal={0} endVal={12345.67} decimals={2} prefix=\"¥\" />\n","blocks":[{"language":"tsx","code":"<CountTo startVal={0} endVal={12345.67} decimals={2} prefix=\"¥\" />\n"}]}],"allowUnknownProps":false},{"name":"createRouter","id":"create-router","label":"createRouter","category":"公共 API","categoryId":"api","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/core.ts","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","props":[{"name":"routeTree","type":"TTree","optional":false,"description":""},{"name":"initial","type":"string","optional":false,"description":""},{"name":"toPath","type":"string | null","optional":false,"description":"Normalize host path aliases. Matching belongs to TanStack."},{"name":"fromMatch","type":"R | null","optional":false,"description":""},{"name":"stringify","type":"string","optional":false,"description":""},{"name":"initialRoutes","type":"R[]","optional":true,"description":""},{"name":"historyState","type":"RouterHistoryState","optional":true,"description":""}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Curtain","id":"curtain","label":"Curtain 幕帘","category":"数据展示","categoryId":"display","kind":"component","description":"幕帘用于展示活动图片或重要公告,支持关闭按钮、自定义位置和背景遮罩。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Curtain.tsx","docPath":"docs/ui/components/curtain.md","doc":"# Curtain 幕帘\n\n幕帘用于展示活动图片或重要公告,支持关闭按钮、自定义位置和背景遮罩。\n\n```tsx\nimport { Curtain } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 展示活动\n\n通过 `value` 和 `onChange` 控制幕帘显示,通过 `src` 指定活动图片。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开活动\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Curtain\n value={show}\n onChange={setShow}\n src=\"https://example.com/banner.jpg\"\n/>\n```\n\n## 组件样式\n\n### 关闭按钮位置\n\n通过 `closePosition` 设置关闭按钮位置,例如 `top-right` 表示右上方。\n\n```tsx\n<Curtain\n value={false}\n src=\"https://example.com/banner.jpg\"\n closePosition=\"top-right\"\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `boolean` | 必填 |\n| src | 图片或媒体地址 | `string` | 必填 |\n| width | 宽度 | `number` | — |\n| to | 跳转目标地址 | `string` | — |\n| closePosition | 关闭按钮位置 | `CurtainClosePosition` | — |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | — |\n| closeOnClick | 点击内容是否关闭 | `boolean` | — |\n| zIndex | 浮层层级 | `number` | — |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | — |\n| customCloseClass | 关闭按钮类名 | `string` | — |\n| customCloseStyle | 关闭按钮样式 | `CSSProperties` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onBeforeEnter | 进入动画开始前触发 | () => void |\n| onEnter | 进入动画开始时触发 | () => void |\n| onAfterEnter | 进入动画完成时触发 | () => void |\n| onBeforeLeave | 离开动画开始前触发 | () => void |\n| onLeave | 离开动画开始时触发 | () => void |\n| onAfterLeave | 离开动画完成时触发 | () => void |\n| onChange | 值发生变化时触发 | (value:boolean)=>void |\n| onNavigate | 对应操作发生时触发 | (url:string)=>void |\n| onClick | 点击时触发 | ()=>void |\n| onClose | 关闭时触发 | (reason:'close'\\|'modal'\\|'image')=>void |\n| onClickModal | 点击遮罩时触发 | ()=>void |\n| onClosed | 对应操作发生时触发 | ()=>void |\n| onLoad | 对应操作发生时触发 | (event:BaseEvent<'load',ImageLoadEvent>)=>void |\n| onError | 发生错误时触发 | (event:BaseEvent<'error',ImageErrorEvent>)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderClose | 自定义区域内容 | (close:()=>void)=>ReactNode |\n\n## 数据类型\n\n```tsx\nexport type CurtainClosePosition =\n | 'inset'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-curtain-radius` | 当前组件 |\n\n## 源代码\n\n[Curtain 组件源码](./sources/curtain/Curtain.tsx.txt) · [示例源码](./sources/curtain/demo.tsx.txt) · [文档源码](./sources/curtain/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Curtain } from 'daisu-ui';\nimport type { CurtainClosePosition } from 'daisu-ui';\nimport cat from '../../../assets/demo-cat-large.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst positions:CurtainClosePosition[]=['inset','top-left','top','top-right','bottom-left','bottom','bottom-right','bottom-right','inset'];\nexport function CurtainExample(){\n const [opened,setOpened]=useState<number|null>(null);\n const button=(index:number,label:string)=><Button key={index} label={label} onTap={()=>{ 'background only';setOpened(index); }}/>,hide=()=>{ 'background only';setOpened(null); };\n return <view className=\"demo-curtain-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-curtain-buttons\">{button(0,'关闭按钮在内部')}</view></ExampleBlock></DemoGroup><DemoGroup title=\"组件样式\"><ExampleBlock title=\"修改按钮位置\"><view className=\"demo-curtain-buttons\">{['左上','顶部','右上','左下','底部','右下'].map((label,index)=>button(index+1,label))}</view></ExampleBlock></DemoGroup><DemoGroup title=\"组件状态\"><ExampleBlock title=\"点击遮罩关闭\"><view className=\"demo-curtain-buttons\">{button(7,'点击遮罩关闭')}</view></ExampleBlock></DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"自定义关闭按钮\"><view className=\"demo-curtain-buttons\">{button(8,'自定义关闭按钮')}</view></ExampleBlock></DemoGroup>\n {positions.map((position,index)=><Curtain key={index} src={cat} width={280} value={opened===index} onChange={hide} rootPortal closePosition={position} closeOnClickModal={index===7} renderClose={index===8?close=><text className=\"demo-curtain-custom-close\" catchtap={close}>关闭</text>:undefined}/>)}\n </view>;\n}\n","props":[{"name":"value","type":"boolean","optional":false,"description":"当前值;传入后由调用方更新","defaultValue":"必填","values":[false,true]},{"name":"src","type":"string","optional":false,"description":"图片或媒体地址","defaultValue":"必填"},{"name":"width","type":"number","optional":true,"description":"宽度"},{"name":"to","type":"string","optional":true,"description":"跳转目标地址"},{"name":"closePosition","type":"CurtainClosePosition","optional":true,"description":"关闭按钮位置","values":["bottom","top","inset","top-left","top-right","bottom-left","bottom-right"]},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","values":[false,true]},{"name":"closeOnClick","type":"boolean","optional":true,"description":"点击内容是否关闭","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","values":[false,true]},{"name":"customCloseClass","type":"string","optional":true,"description":"关闭按钮类名"},{"name":"customCloseStyle","type":"CSSProperties","optional":true,"description":"关闭按钮样式"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onBeforeEnter","type":"() => void","optional":true,"description":"进入动画开始前触发"},{"name":"onEnter","type":"() => void","optional":true,"description":"进入动画开始时触发"},{"name":"onAfterEnter","type":"() => void","optional":true,"description":"进入动画完成时触发"},{"name":"onBeforeLeave","type":"() => void","optional":true,"description":"离开动画开始前触发"},{"name":"onLeave","type":"() => void","optional":true,"description":"离开动画开始时触发"},{"name":"onAfterLeave","type":"() => void","optional":true,"description":"离开动画完成时触发"},{"name":"onChange","type":"(value:boolean)=>void","optional":true,"description":"值发生变化时触发"},{"name":"onNavigate","type":"(url:string)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onClick","type":"()=>void","optional":true,"description":"点击时触发"},{"name":"onClose","type":"(reason:'close'|'modal'|'image')=>void","optional":true,"description":"关闭时触发"},{"name":"onClickModal","type":"()=>void","optional":true,"description":"点击遮罩时触发"},{"name":"onClosed","type":"()=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onLoad","type":"(event:BaseEvent<'load',ImageLoadEvent>)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onError","type":"(event:BaseEvent<'error',ImageErrorEvent>)=>void","optional":true,"description":"发生错误时触发"}],"slots":[{"name":"renderClose","type":"(close:()=>void)=>ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-curtain-radius","defaultValue":"8px","description":""}],"demos":[{"name":"basic","aliases":["demo-1","展示活动"],"title":"展示活动","section":"基础用法","description":"通过 `value` 和 `onChange` 控制幕帘显示,通过 `src` 指定活动图片。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开活动\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Curtain\n value={show}\n onChange={setShow}\n src=\"https://example.com/banner.jpg\"\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开活动\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Curtain\n value={show}\n onChange={setShow}\n src=\"https://example.com/banner.jpg\"\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","关闭按钮位置"],"title":"关闭按钮位置","section":"组件样式","description":"通过 `closePosition` 设置关闭按钮位置,例如 `top-right` 表示右上方。","language":"tsx","code":"<Curtain\n value={false}\n src=\"https://example.com/banner.jpg\"\n closePosition=\"top-right\"\n/>\n","blocks":[{"language":"tsx","code":"<Curtain\n value={false}\n src=\"https://example.com/banner.jpg\"\n closePosition=\"top-right\"\n/>\n"}]}],"allowUnknownProps":false},{"name":"datetimeLabel","id":"datetime-label","label":"datetimeLabel","category":"公共 API","categoryId":"api","kind":"utility","description":"datetimeLabel 公开 API","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/datetimePickerModel.ts","doc":"","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of a string.\nReturns a string representation of an object."},{"name":"valueOf","type":"string","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"toLocaleString","type":"string","optional":false,"description":"Returns a date converted to a string using the current locale.\nConverts a number to a string by using the current or specified locale."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"datetimePad","id":"datetime-pad","label":"datetimePad","category":"公共 API","categoryId":"api","kind":"utility","description":"datetimePad 公开 API","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/datetimePickerModel.ts","doc":"","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of an object."},{"name":"toFixed","type":"string","optional":false,"description":"Returns a string representing a number in fixed-point notation."},{"name":"toExponential","type":"string","optional":false,"description":"Returns a string containing a number represented in exponential notation."},{"name":"toPrecision","type":"string","optional":false,"description":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."},{"name":"valueOf","type":"number","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"toLocaleString","type":"string","optional":false,"description":"Converts a number to a string by using the current or specified locale."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"DatetimePicker","id":"datetime-picker","label":"DatetimePicker 日期时间选择器","category":"录入","categoryId":"form","kind":"component","description":"日期时间选择器以弹层方式选择日期和时间,支持范围限制、自定义文案和确认校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/DatetimePicker.tsx","docPath":"docs/ui/components/datetime-picker.md","doc":"# DatetimePicker 日期时间选择器\n\n日期时间选择器以弹层方式选择日期和时间,支持范围限制、自定义文案和确认校验。\n\n```tsx\nimport { DatetimePicker } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 选择日期时间\n\n设置 `type=\"datetime\"`,通过 `visible` 控制弹层,`onConfirm` 获取确认后的时间值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择时间\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<DatetimePicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"datetime\"\n value={Date.now()}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件变体\n\n### 选择日期\n\n设置 `type=\"date\"` 仅展示日期选项。\n\n```tsx\n<DatetimePicker visible={false} type=\"date\" value={Date.now()} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| filter | 选项过滤函数 | `DatetimeFilter` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| type | 类型 | `DatetimePickerType` | — |\n| minDate | 最小可选择日期 | `number` | — |\n| maxDate | 最大可选择日期 | `number` | — |\n| minHour | 最小时 | `number` | — |\n| maxHour | 最大小时 | `number` | — |\n| minMinute | 最小分钟 | `number` | — |\n| maxMinute | 最大分钟 | `number` | — |\n| useSecond | 是否包含秒 | `boolean` | — |\n| minSecond | 最小秒数 | `number` | — |\n| maxSecond | 最大秒数 | `number` | — |\n| boundaryMinDate | 可浏览的最小日期 | `number` | — |\n| boundaryMaxDate | 可浏览的最大日期 | `number` | — |\n| formatter | 内容格式化函数 | `(type: DatetimeColumnType, value: number) => string` | — |\n| columnFormatter | 选项列格式化函数 | `(columns: PickerOption[][]) => PickerOption[][]` | — |\n| itemHeight | 数据项高度 | `number` | — |\n| visibleItemCount | 滚轮可见行数 | `number` | — |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | — |\n| value | 当前值;传入后由调用方更新 | `V` | — |\n| visible | 是否显示选择面板 | `boolean` | — |\n| title | 标题内容 | `string` | `''` |\n| cancelButtonText | 取消按钮文案 | `string` | `'取消'` |\n| confirmButtonText | 确认按钮文案 | `string` | `'完成'` |\n| beforeConfirm | 确认前校验 | `(value: Result<V>) => boolean \\| Promise<boolean>` | — |\n| displayFormatTabLabel | 级联选项页签的显示格式 | `(items: PickerOption[]) => string` | — |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `true` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n| zIndex | 浮层层级 | `number` | `100` |\n| viewClassName | 选择面板类名 | `string` | `''` |\n\n泛型约束:`V extends DatetimePickerModelValue = DatetimePickerValue`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n| onVisibleChange | 面板显示状态变化时触发 | (visible: boolean) => void |\n| onConfirm | 确认选择时触发 | (event: { value: Result<V> }) => void |\n| onChange | 值发生变化时触发 | (event: { value: Result<V> }) => void |\n| onPickChange | 对应操作发生时触发 | (event: { value: Result<V> }) => void |\n| onToggle | 对应操作发生时触发 | (value: DatetimePickerValue) => void |\n| onCancel | 取消操作时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n| onOpen | 打开时触发 | () => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type DatetimePickerType =\n | 'datetime'\n | 'date'\n | 'year-month'\n | 'time'\n | 'year';\n\nexport type DatetimeColumnType =\n | 'year'\n | 'month'\n | 'date'\n | 'hour'\n | 'minute'\n | 'second';\n\nexport type PickerOption = {\n value: PickerValue;\n label: string;\n disabled?: boolean;\n children?: readonly PickerOption[];\n};\n\nexport type DatetimePickerValue = number | string;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[DatetimePicker 组件源码](./sources/datetime-picker/DatetimePicker.tsx.txt) · [示例源码](./sources/datetime-picker/demo.tsx.txt) · [文档源码](./sources/datetime-picker/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Cell, CellGroup, DatetimePicker, Toast, useToast } from 'daisu-ui';\nimport type { DatetimePickerModelValue, DatetimePickerType, DatetimePickerValue, PickerOption } from 'daisu-ui';\nimport { datetimeLabel } from 'daisu-ui/utils';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { datetimeUnits, fiveMinuteFilter } from './datetimeShared.js';\nconst typeFor = (key: string): DatetimePickerType => key === 'date' ? 'date' : key === 'month' ? 'year-month' : key === 'year' ? 'year' : key === 'time' || key === 'timeSeconds' ? 'time' : 'datetime';\nconst secondsFor = (key: string) => key === 'seconds' || key === 'timeSeconds' || key === 'range';\nconst tabLabel = (items: PickerOption[]) => `${items[0]?.label}年${items[1]?.label}月${items[2]?.label}日 ${items[3]?.label}:${items[4]?.label}`;\nexport function DatetimePickerExample() {\n const [now] = useState(() => Date.now()), [opened, setOpened] = useState(''), [values, setValues] = useState<Record<string, DatetimePickerModelValue>>(() => { const now = Date.now(); return { basic: '', limit: now, validate: now, seconds: now, date: now, month: now, year: now, time: '09:20', timeSeconds: '09:20:26', range: ['', ''], rangeFormat: ['', now], display: now, format: now, filter: now }; });\n const toast = useToast(), pending = useRef<{ timer: ReturnType<typeof setTimeout>; resolve: (allow: boolean) => void }>();\n const cancelPending = () => { 'background only'; if (pending.current) { clearTimeout(pending.current.timer); pending.current.resolve(false); pending.current = undefined; toast.close(); } };\n useEffect(() => () => { if (pending.current) { clearTimeout(pending.current.timer); pending.current.resolve(false); } }, []);\n const beforeConfirm = (value: DatetimePickerModelValue) => {\n 'background only'; toast.loading({ msg: '处理中', zIndex: 110 });\n return new Promise<boolean>(resolve => { const timer = setTimeout(() => { pending.current = undefined; toast.close(); const allow = typeof value === 'number' && value <= Date.now(); if (!allow) toast.error({ msg: '不能选择大于今天的日期', zIndex: 110 }); resolve(allow); }, 2000); pending.current = { timer, resolve }; });\n };\n const row = (key: string, title: string) => {\n const value = values[key]!, text = Array.isArray(value) ? value.some(item => item !== '') ? value.map(item => datetimeLabel(item, 'datetime', true)).join(' - ') : '' : datetimeLabel(value as DatetimePickerValue, typeFor(key), secondsFor(key));\n const display = key === 'display' ? text.replace(/^(\\d+)-(\\d+)-(\\d+)/, '$1年$2月$3日') : text;\n return <Cell key={key} title={title} value={display} arrow placeholder={key === 'basic' ? '请选择' : undefined} titleWidth={key === 'basic' ? '33%' : undefined} valueAlign={key === 'basic' ? 'left' : undefined} onTap={() => setOpened(key)} />;\n };\n const nextYear = new Date(now); nextYear.setFullYear(nextYear.getFullYear() + 1); nextYear.setHours(0, 0, 0, 0);\n return <view className=\"demo-datetime-picker-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><CellGroup border>{row('basic', '日期选择')}{row('limit', '时间范围一年')}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"before-confirm\" noPadding><CellGroup border>{row('validate', 'before-confirm')}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"日期类型\" noPadding><CellGroup border>{row('seconds', '日期选择(带秒)')}{row('date', '年月日')}{row('month', '年月')}{row('year', '年')}{row('time', '时分')}{row('timeSeconds', '时间选择(带秒)')}</CellGroup></ExampleBlock><ExampleBlock title=\"区域选择\" noPadding><CellGroup border>{row('range', '日期选择')}{row('rangeFormat', '日期选择')}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"展示格式与内部格式\" noPadding><CellGroup border>{row('display', '展示格式')}{row('format', '内部格式')}{row('filter', '过滤选项')}</CellGroup></ExampleBlock></DemoGroup>\n {Object.keys(values).map(key => <DatetimePicker key={key} visible={opened === key} value={values[key]} type={typeFor(key)} useSecond={secondsFor(key)} onVisibleChange={show => { 'background only'; if (!show) { setOpened(''); cancelPending(); } }} title={key === 'range' ? '请选择区间' : ''} minDate={key === 'limit' ? now : undefined} maxDate={key === 'limit' ? nextYear.getTime() : undefined} beforeConfirm={key === 'validate' ? beforeConfirm : undefined} displayFormatTabLabel={key === 'rangeFormat' ? tabLabel : undefined} formatter={key === 'format' ? datetimeUnits : undefined} filter={key === 'filter' ? fiveMinuteFilter : undefined} onConfirm={({ value }) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); }} />)}\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"filter","type":"DatetimeFilter","optional":true,"description":"选项过滤函数"},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","values":[false,true]},{"name":"type","type":"DatetimePickerType","optional":true,"description":"类型","values":["date","datetime","year-month","time","year"]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"itemHeight","type":"number","optional":true,"description":"数据项高度"},{"name":"visibleItemCount","type":"number","optional":true,"description":"滚轮可见行数"},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","values":[false,true]},{"name":"minDate","type":"number","optional":true,"description":"最小可选择日期"},{"name":"maxDate","type":"number","optional":true,"description":"最大可选择日期"},{"name":"minHour","type":"number","optional":true,"description":"最小时"},{"name":"maxHour","type":"number","optional":true,"description":"最大小时"},{"name":"minMinute","type":"number","optional":true,"description":"最小分钟"},{"name":"maxMinute","type":"number","optional":true,"description":"最大分钟"},{"name":"useSecond","type":"boolean","optional":true,"description":"是否包含秒","values":[false,true]},{"name":"minSecond","type":"number","optional":true,"description":"最小秒数"},{"name":"maxSecond","type":"number","optional":true,"description":"最大秒数"},{"name":"boundaryMinDate","type":"number","optional":true,"description":"可浏览的最小日期"},{"name":"boundaryMaxDate","type":"number","optional":true,"description":"可浏览的最大日期"},{"name":"formatter","type":"(type: DatetimeColumnType, value: number) => string","optional":true,"description":"内容格式化函数"},{"name":"columnFormatter","type":"(columns: PickerOption[][]) => PickerOption[][]","optional":true,"description":"选项列格式化函数"},{"name":"value","type":"V","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"visible","type":"boolean","optional":true,"description":"是否显示选择面板","values":[false,true]},{"name":"title","type":"string","optional":true,"description":"标题内容","defaultValue":"''"},{"name":"cancelButtonText","type":"string","optional":true,"description":"取消按钮文案","defaultValue":"'取消'"},{"name":"confirmButtonText","type":"string","optional":true,"description":"确认按钮文案","defaultValue":"'完成'"},{"name":"beforeConfirm","type":"(value: Result<V>) => boolean | Promise<boolean>","optional":true,"description":"确认前校验"},{"name":"displayFormatTabLabel","type":"(items: PickerOption[]) => string","optional":true,"description":"级联选项页签的显示格式"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"100"},{"name":"viewClassName","type":"string","optional":true,"description":"选择面板类名","defaultValue":"''"}],"events":[{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"面板显示状态变化时触发"},{"name":"onConfirm","type":"(event: { value: Result<V> }) => void","optional":true,"description":"确认选择时触发"},{"name":"onChange","type":"(event: { value: Result<V> }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPickChange","type":"(event: { value: Result<V> }) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onToggle","type":"(value: DatetimePickerValue) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消操作时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","选择日期时间"],"title":"选择日期时间","section":"组件类型","description":"设置 `type=\"datetime\"`,通过 `visible` 控制弹层,`onConfirm` 获取确认后的时间值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择时间\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<DatetimePicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"datetime\"\n value={Date.now()}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择时间\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<DatetimePicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"datetime\"\n value={Date.now()}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","选择日期"],"title":"选择日期","section":"组件变体","description":"设置 `type=\"date\"` 仅展示日期选项。","language":"tsx","code":"<DatetimePicker visible={false} type=\"date\" value={Date.now()} />\n","blocks":[{"language":"tsx","code":"<DatetimePicker visible={false} type=\"date\" value={Date.now()} />\n"}]}],"allowUnknownProps":false},{"name":"DatetimePickerView","id":"datetime-picker-view","label":"DatetimePickerView 日期时间选择器视图","category":"录入","categoryId":"form","kind":"component","description":"日期时间选择器视图在页面内展示时间滚轮,可限制时间范围并调整选择类型。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/DatetimePickerView.tsx","docPath":"docs/ui/components/datetime-picker-view.md","doc":"# DatetimePickerView 日期时间选择器视图\n\n日期时间选择器视图在页面内展示时间滚轮,可限制时间范围并调整选择类型。\n\n```tsx\nimport { DatetimePickerView } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 日期时间\n\n设置 `type=\"datetime\"` 选择日期与时间,通过 `value` 设置当前值,`onChange` 获取选择结果。\n\n```tsx\n<DatetimePickerView\n value={Date.now()}\n type=\"datetime\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件变体\n\n### 日期选择\n\n设置 `type=\"date\"` 仅选择日期。\n\n```tsx\n<DatetimePickerView value={Date.now()} type=\"date\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `DatetimePickerValue` | — |\n| type | 类型 | `DatetimePickerType` | — |\n| minDate | 最小可选择日期 | `number` | — |\n| maxDate | 最大可选择日期 | `number` | — |\n| minHour | 最小时 | `number` | — |\n| maxHour | 最大小时 | `number` | — |\n| minMinute | 最小分钟 | `number` | — |\n| maxMinute | 最大分钟 | `number` | — |\n| useSecond | 是否包含秒 | `boolean` | — |\n| minSecond | 最小秒数 | `number` | — |\n| maxSecond | 最大秒数 | `number` | — |\n| boundaryMinDate | 可浏览的最小日期 | `number` | — |\n| boundaryMaxDate | 可浏览的最大日期 | `number` | — |\n| formatter | 内容格式化函数 | `(type: DatetimeColumnType, value: number) => string` | — |\n| filter | 选项过滤函数 | `DatetimeFilter` | — |\n| columnFormatter | 选项列格式化函数 | `(columns: PickerOption[][]) => PickerOption[][]` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | — |\n| itemHeight | 数据项高度 | `number` | — |\n| visibleItemCount | 滚轮可见行数 | `number` | — |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: DatetimePickerChange) => void |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| getSelected | 调用实例方法 | () => DatetimePickerChange |\n| getSelectedOptions | 调用实例方法 | () => PickerOption[] |\n| correctValue | 调用实例方法 | (value: DatetimePickerValue) => DatetimePickerValue |\n| getOriginColumns | 调用实例方法 | () => DatetimeColumn[] |\n\n## 数据类型\n\n```tsx\nexport type DatetimePickerValue = number | string;\n\nexport type DatetimePickerType =\n | 'datetime'\n | 'date'\n | 'year-month'\n | 'time'\n | 'year';\n\nexport type DatetimeColumnType =\n | 'year'\n | 'month'\n | 'date'\n | 'hour'\n | 'minute'\n | 'second';\n\nexport type PickerOption = {\n value: PickerValue;\n label: string;\n disabled?: boolean;\n children?: readonly PickerOption[];\n};\n\nexport type DatetimePickerChange = {\n value: DatetimePickerValue;\n columns: DatetimeColumn[];\n selectedOptions: PickerOption[];\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[DatetimePickerView 组件源码](./sources/datetime-picker-view/DatetimePickerView.tsx.txt) · [示例源码](./sources/datetime-picker-view/demo.tsx.txt) · [文档源码](./sources/datetime-picker-view/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { DatetimePickerView, Toast, useToast } from 'daisu-ui';\nimport type { DatetimePickerType, DatetimePickerValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { datetimeUnits, fiveMinuteFilter } from './datetimeShared.js';\nexport function DatetimePickerViewExample() {\n const [values, setValues] = useState<Record<string, DatetimePickerValue>>(() => { const now = Date.now(); return { basic: '', seconds: now, date: now, month: now, year: '', time: '11:12', timeSeconds: '11:12:13', format: now, filter: now }; }), toast = useToast();\n const example = (key: string, title: string, type: DatetimePickerType = 'datetime') => <ExampleBlock key={key} title={title}><DatetimePickerView value={values[key]} type={type} useSecond={key === 'seconds' || key === 'timeSeconds'} formatter={key === 'format' ? datetimeUnits : undefined} filter={key === 'filter' ? fiveMinuteFilter : undefined} onChange={({ value }) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); if (key === 'basic') toast.show(`选择了${new Date(value)}`); }} /></ExampleBlock>;\n return <view className=\"demo-datetime-picker-view-page\">\n <DemoGroup title=\"组件类型\">{example('basic', '日期选择')}</DemoGroup>\n <DemoGroup title=\"组件变体\">{example('seconds', '日期选择(带秒)')}{example('date', '年月日', 'date')}{example('month', '年月', 'year-month')}{example('year', '年', 'year')}{example('time', '时分', 'time')}{example('timeSeconds', '时间选择(带秒)', 'time')}</DemoGroup>\n <DemoGroup title=\"组件样式\">{example('format', '内部格式')}{example('filter', '过滤选项')}</DemoGroup>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"value","type":"DatetimePickerValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"type","type":"DatetimePickerType","optional":true,"description":"类型","values":["date","datetime","year-month","time","year"]},{"name":"minDate","type":"number","optional":true,"description":"最小可选择日期"},{"name":"maxDate","type":"number","optional":true,"description":"最大可选择日期"},{"name":"minHour","type":"number","optional":true,"description":"最小时"},{"name":"maxHour","type":"number","optional":true,"description":"最大小时"},{"name":"minMinute","type":"number","optional":true,"description":"最小分钟"},{"name":"maxMinute","type":"number","optional":true,"description":"最大分钟"},{"name":"useSecond","type":"boolean","optional":true,"description":"是否包含秒","values":[false,true]},{"name":"minSecond","type":"number","optional":true,"description":"最小秒数"},{"name":"maxSecond","type":"number","optional":true,"description":"最大秒数"},{"name":"boundaryMinDate","type":"number","optional":true,"description":"可浏览的最小日期"},{"name":"boundaryMaxDate","type":"number","optional":true,"description":"可浏览的最大日期"},{"name":"formatter","type":"(type: DatetimeColumnType, value: number) => string","optional":true,"description":"内容格式化函数"},{"name":"filter","type":"DatetimeFilter","optional":true,"description":"选项过滤函数"},{"name":"columnFormatter","type":"(columns: PickerOption[][]) => PickerOption[][]","optional":true,"description":"选项列格式化函数"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","values":[false,true]},{"name":"itemHeight","type":"number","optional":true,"description":"数据项高度"},{"name":"visibleItemCount","type":"number","optional":true,"description":"滚轮可见行数"},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: DatetimePickerChange) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"getSelected","description":"调用实例方法","type":"() => DatetimePickerChange"},{"name":"getSelectedOptions","description":"调用实例方法","type":"() => PickerOption[]"},{"name":"correctValue","description":"调用实例方法","type":"(value: DatetimePickerValue) => DatetimePickerValue"},{"name":"getOriginColumns","description":"调用实例方法","type":"() => DatetimeColumn[]"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","日期时间"],"title":"日期时间","section":"组件类型","description":"设置 `type=\"datetime\"` 选择日期与时间,通过 `value` 设置当前值,`onChange` 获取选择结果。","language":"tsx","code":"<DatetimePickerView\n value={Date.now()}\n type=\"datetime\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<DatetimePickerView\n value={Date.now()}\n type=\"datetime\"\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","日期选择"],"title":"日期选择","section":"组件变体","description":"设置 `type=\"date\"` 仅选择日期。","language":"tsx","code":"<DatetimePickerView value={Date.now()} type=\"date\" />\n","blocks":[{"language":"tsx","code":"<DatetimePickerView value={Date.now()} type=\"date\" />\n"}]}],"allowUnknownProps":false},{"name":"Dialog","id":"dialog","label":"Dialog 对话框","category":"反馈","categoryId":"feedback","kind":"component","description":"对话框用于确认操作、展示提醒或收集简单输入,支持异步确认与自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Dialog.tsx","docPath":"docs/ui/components/dialog.md","doc":"# Dialog 对话框\n\n对话框用于确认操作、展示提醒或收集简单输入,支持异步确认与自定义内容。\n\n```tsx\nimport { Dialog } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 消息提醒\n\n将 `useDialog()` 返回的 `props` 绑定到 `Dialog`,调用 `alert()` 显示提醒,通过 `title` 和 `msg` 设置内容。\n\n```tsx\nimport { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n```\n\n### 确认操作\n\n调用 `confirm()` 显示确认对话框,用户确认时 Promise 完成,取消时进入拒绝分支。\n\n```tsx\nconst dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n```\n\n## 组件样式\n\n### 按钮主题\n\n设置 `theme=\"button\"` 使用按钮样式的操作区。\n\n```tsx\n<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | ReactNode 标题 / 纯文本正文 | `ReactNode` | — |\n| msg | ReactNode 标题 / 纯文本正文 | `string` | — |\n| type | alert/confirm/prompt | `'alert' \\| 'confirm' \\| 'prompt'` | `'alert'` |\n| theme | button/text;horizontal/vertical | `'button' \\| 'text'` | `'button'` |\n| actionLayout | button/text;horizontal/vertical | `'horizontal' \\| 'vertical'` | `'horizontal'` |\n| actions | {text,action?:confirm/cancel/action,...公共ButtonProps}[],优先于默认按钮 | `readonly DialogAction[]` | — |\n| showCancelButton | 取消按钮 | `boolean` | — |\n| confirmButtonText | 默认文案 | `string` | `'确定'` |\n| cancelButtonText | 默认文案 | `string` | `'取消'` |\n| confirmButtonProps | 部分DialogAction或string;null隐藏按钮 | `Partial<DialogAction> \\| string \\| null` | — |\n| cancelButtonProps | 部分DialogAction或string;null隐藏按钮 | `Partial<DialogAction> \\| string \\| null` | — |\n| inputValue | 初始值;{placeholder,maxlength,type,multiline,maxlines} | `string \\| number` | `''` |\n| inputProps | 初始值;{placeholder,maxlength,type,multiline,maxlines} | `DialogInputProps` | — |\n| inputPattern | 正则 / (string)=>boolean或错误字符串 | `RegExp` | — |\n| inputValidate | 正则 / (string)=>boolean或错误字符串 | `(value: string) => boolean \\| string` | — |\n| inputError | 校验提示 | `string` | `'输入内容不正确'` |\n| showErr | 校验提示 | `boolean` | `false` |\n| beforeConfirm | (string)=>boolean或Promise<boolean>;false拦截,异常显示可重试错误 | `(value: string) => boolean \\| Promise<boolean>` | — |\n| icon | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| iconColor | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| headerImage | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| closeOnClickModal | 遮罩关闭 / 关闭按钮 | `boolean` | `false` |\n| showClose | 遮罩关闭 / 关闭按钮 | `boolean` | `false` |\n| zIndex | 层级 / 懒挂载 | `number` | `99` |\n| lazyRender | 层级 / 懒挂载 | `boolean` | `true` |\n| requestKey | useDialog内部请求编号,替换请求时使旧确认失效 | `number` | `0` |\n| show | 受控显示 / 关闭请求 / {action,value,index?}结果 | `boolean` | `false` |\n| rootPortal | 原生Portal,需Host | `boolean` | `false` |\n| className | 自定义样式 | `string` | `''` |\n| style | 自定义样式 | `CSSProperties` | — |\n| children | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | `ReactNode` | — |\n| header | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 受控显示 / 关闭请求 / {action,value,index?}结果 | (show: boolean) => void |\n| onResult | 受控显示 / 关闭请求 / {action,value,index?}结果 | (result: DialogResult) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | ReactNode 标题 / 纯文本正文 | ReactNode |\n| children | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | ReactNode |\n| header | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | ReactNode |\n| renderActions | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | (controls: { confirm: () => void; cancel: () => void; close: () => void; pending: boolean }) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type DialogAction = Omit<ButtonProps, 'onTap' | 'label'> & {\n text: string;\n action?: 'confirm' | 'cancel' | 'action';\n};\n\nexport type DialogResult = {\n action: 'confirm' | 'cancel' | 'modal' | 'close' | 'action';\n value: string;\n index?: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Dialog 组件源码](./sources/dialog/Dialog.tsx.txt) · [示例源码](./sources/dialog/demo.tsx.txt) · [文档源码](./sources/dialog/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport type { ReactNode } from '@lynx-js/react';\nimport { Button, Cell, Dialog, Rate, useDialog } from 'daisu-ui';\nimport type { DialogOptions, ButtonTone } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport banner from '../../../assets/demo-capybara.jpg';\n\ntype Sample = { label: string; options: DialogOptions; tone?: ButtonTone; content?: 'rating' | 'custom'; header?: boolean; customTitle?: boolean; customActions?: boolean };\nconst base: DialogOptions = { title: '提示', msg: '这是一条消息提示' };\nconst confirm: DialogOptions = { title: '提示', msg: '确认执行此操作吗?', type: 'confirm' };\nconst prompt: DialogOptions = { title: '请输入内容', type: 'prompt', inputProps: { placeholder: '请输入' } };\nconst sample = (label: string, options: DialogOptions, extra?: Omit<Sample, 'label' | 'options'>): Sample => ({ label, options, ...extra });\nconst groups: { title: string; blocks: { title: string; samples: Sample[] }[] }[] = [\n { title: '组件类型', blocks: [\n { title: '基础用法', samples: [sample('Alert 弹窗', base), sample('Confirm 弹窗', confirm), sample('Prompt 输入框', prompt), sample('标题 + 内容', { title: '操作提示', msg: '您的请求已经提交,我们会尽快处理。' })] },\n { title: '弹窗类型', samples: [sample('Alert 类型', base, { tone: 'success' }), sample('Confirm 类型', confirm), sample('Prompt 类型', prompt, { tone: 'warning' })] },\n ] },\n { title: '组件状态', blocks: [\n { title: '输入配置(Prompt)', samples: [sample('带占位符', { ...prompt, inputProps: { placeholder: '请输入内容' } }), sample('带默认值', { ...prompt, inputValue: '默认内容' }), sample('多行文本输入', { ...prompt, inputProps: { multiline: true, placeholder: '请输入详细内容' } }), sample('限制输入长度', { ...prompt, inputProps: { maxlength: 10, placeholder: '最多输入10个字' } }), sample('正则校验', { ...prompt, title: '请输入邮箱', inputPattern: /.+@.+\\..+/i, inputError: '邮箱格式不正确' }), sample('函数校验', { ...prompt, title: '请输入手机号', inputValidate: value => /^1[3-9]\\d{9}$/.test(value), inputError: '手机号格式不正确' }), sample('数字输入', { ...prompt, inputProps: { type: 'number' } }), sample('密码输入', { ...prompt, inputProps: { type: 'password' } })] },\n { title: '交互功能', samples: [sample('显示关闭按钮', { ...base, showClose: true }), sample('点击遮罩关闭', { ...base, closeOnClickModal: true }), sample('确认前钩子', { ...prompt, inputProps: { placeholder: '输入 confirm 以确认' }, beforeConfirm: value => value === 'confirm' }), sample('异步确认前钩子', { ...confirm, beforeConfirm: () => new Promise(resolve => setTimeout(() => resolve(true), 1500)) }), sample('自定义层级', { ...base, zIndex: 200 })] },\n { title: '按钮状态', samples: [sample('按钮加载状态', { ...base, showClose: true, confirmButtonProps: { loading: true } }), sample('禁用按钮', { ...confirm, confirmButtonProps: { disabled: true } })] },\n ] },\n { title: '组件变体', blocks: [\n { title: '弹窗风格', samples: [sample('Button 风格(默认)', confirm), sample('Text 风格(iOS 风格)', { ...confirm, theme: 'text' }), sample('Text 风格 + 垂直布局', { ...confirm, theme: 'text', actionLayout: 'vertical' })] },\n { title: '操作按钮配置', samples: [sample('自定义按钮文本', { ...confirm, confirmButtonText: '立即前往', cancelButtonText: '再想想' }), sample('自定义按钮样式', { ...confirm, confirmButtonProps: { tone: 'success' }, cancelButtonProps: { tone: 'danger' } }), sample('垂直排列按钮', { ...confirm, actionLayout: 'vertical' }), sample('单个按钮', { ...confirm, cancelButtonProps: null }), sample('多个按钮(Actions)', { title: '选择支付方式', actionLayout: 'vertical', actions: [{ text: '微信支付', tone: 'success' }, { text: '支付宝', tone: 'primary' }, { text: '取消', tone: 'neutral', action: 'cancel' }] })] },\n ] },\n { title: '组件样式', blocks: [{ title: '图标与头图', samples: [\n sample('成功图标', { ...base, icon: 'success', iconColor: '#12b886' }), sample('危险图标', { ...base, icon: 'danger', iconColor: '#f14646' }), sample('警告图标', { ...base, icon: 'warning', iconColor: '#f57f00' }), sample('信息图标', { ...base, icon: 'info', iconColor: '#1c64fd' }), sample('自定义图标', { ...base, icon: 'star-fill', iconColor: '#f57f00' }), sample('顶部图片(完整)', { ...base, headerImage: banner }), sample('顶部图片 + 标题', { title: '活动通知', headerImage: banner }), sample('顶部图片 + 内容', { msg: '恭喜您获得专属权益', headerImage: banner }), sample('顶部图片(纯图片)', { headerImage: banner, showClose: true, confirmButtonProps: null }), sample('自定义按钮配色', { ...base, confirmButtonProps: { tone: 'success' } }),\n ] }] },\n { title: '特殊样式', blocks: [\n { title: '插槽能力', samples: [sample('默认插槽:自定义内容', { title: '请为我们评分', type: 'confirm' }, { content: 'rating' }), sample('Header 插槽:顶部图片', base, { header: true }), sample('Title 插槽:自定义标题', base, { customTitle: true }), sample('Actions 插槽:多支付方式', { title: '请选择支付方式' }, { customActions: true })] },\n { title: '业务场景示例', samples: [sample('删除确认', { title: '删除确认', msg: '删除后无法恢复,确定删除吗?', type: 'confirm', confirmButtonProps: { text: '删除', tone: 'danger' } }), sample('支付确认', { title: '支付确认', msg: '确认支付 ¥99.00?', type: 'confirm' }), sample('表单提交', { title: '提交成功', msg: '您的信息已提交成功', icon: 'success' }), sample('用户反馈选择', { title: '反馈类型', actionLayout: 'vertical', actions: [{ text: '功能建议' }, { text: '问题反馈' }, { text: '取消', action: 'cancel', tone: 'neutral' }] }), sample('版本更新', { title: '版本更新', msg: '发现新版本,是否立即更新?', type: 'confirm' }), sample('拨打电话', { title: '拨打电话', msg: '10086', type: 'confirm', confirmButtonText: '确定' }), sample('地址录入', { ...prompt, title: '请输入地址', inputProps: { multiline: true, placeholder: '请输入详细地址' } }), sample('领取优惠券', { title: '优惠券', msg: '恭喜您获得满100减20优惠券', confirmButtonText: '立即领取' })] },\n ] },\n];\n\nexport function DialogExample() {\n const dialog = useDialog();\n const [current, setCurrent] = useState<Sample | null>(null);\n const [rating, setRating] = useState(3);\n const [result, setResult] = useState('');\n const open = (entry: Sample) => {\n 'background only'; setCurrent(entry); setResult('');\n void dialog.show(entry.options).then(value => setResult(value.value ? `输入内容:${value.value}` : '点击了确认')).catch(() => {});\n };\n const title: ReactNode = current?.customTitle ? <view className=\"demo-dialog-title\"><text>自定义标题</text><text>温馨提示</text></view> : dialog.props.title;\n return <view>{groups.map(group => <DemoGroup key={group.title} title={group.title}>{group.blocks.map(block => <ExampleBlock key={block.title} title={block.title}><view className=\"demo-dialog-buttons\">{block.samples.map(entry => <Button key={entry.label} block label={entry.label} tone={entry.tone} onTap={() => open(entry)} />)}</view></ExampleBlock>)}</DemoGroup>)}\n <Dialog {...dialog.props} title={title} rootPortal className=\"ui-demo-page\" header={current?.header ? <image className=\"ui-dialog-header-image\" src={banner} mode=\"aspectFill\" /> : undefined} renderActions={current?.customActions ? ({ confirm, cancel }) => <view className=\"demo-dialog-custom-actions\"><Button label=\"微信支付\" tone=\"success\" block onTap={confirm} /><Button label=\"支付宝\" block onTap={confirm} /><Button label=\"取消\" tone=\"neutral\" variant=\"plain\" block onTap={cancel} /></view> : undefined}>\n {current?.content === 'rating' ? <view className=\"demo-dialog-rating\"><Rate value={rating} onChange={({ value }) => setRating(value)} /><text>{rating} 分</text></view> : undefined}\n </Dialog>\n {result ? <view className=\"demo-action-sheet-notice\" bindtap={() => setResult('')}><text>{result}</text></view> : null}\n </view>;\n}\n","props":[{"name":"title","type":"ReactNode","optional":true,"description":"ReactNode 标题 / 纯文本正文"},{"name":"msg","type":"string","optional":true,"description":"ReactNode 标题 / 纯文本正文"},{"name":"type","type":"'alert' | 'confirm' | 'prompt'","optional":true,"description":"alert/confirm/prompt","defaultValue":"'alert'","values":["alert","confirm","prompt"]},{"name":"theme","type":"'button' | 'text'","optional":true,"description":"button/text;horizontal/vertical","defaultValue":"'button'","values":["text","button"]},{"name":"actionLayout","type":"'horizontal' | 'vertical'","optional":true,"description":"button/text;horizontal/vertical","defaultValue":"'horizontal'","values":["vertical","horizontal"]},{"name":"actions","type":"readonly DialogAction[]","optional":true,"description":"{text,action?:confirm/cancel/action,...公共ButtonProps}[],优先于默认按钮"},{"name":"showCancelButton","type":"boolean","optional":true,"description":"取消按钮","defaultValue":"type !== 'alert'","values":[false,true]},{"name":"confirmButtonText","type":"string","optional":true,"description":"默认文案","defaultValue":"'确定'"},{"name":"cancelButtonText","type":"string","optional":true,"description":"默认文案","defaultValue":"'取消'"},{"name":"confirmButtonProps","type":"Partial<DialogAction> | string | null","optional":true,"description":"部分DialogAction或string;null隐藏按钮"},{"name":"cancelButtonProps","type":"Partial<DialogAction> | string | null","optional":true,"description":"部分DialogAction或string;null隐藏按钮"},{"name":"inputValue","type":"string | number","optional":true,"description":"初始值;{placeholder,maxlength,type,multiline,maxlines}","defaultValue":"''"},{"name":"inputProps","type":"DialogInputProps","optional":true,"description":"初始值;{placeholder,maxlength,type,multiline,maxlines}"},{"name":"inputPattern","type":"RegExp","optional":true,"description":"正则 / (string)=>boolean或错误字符串"},{"name":"inputValidate","type":"(value: string) => boolean | string","optional":true,"description":"正则 / (string)=>boolean或错误字符串"},{"name":"inputError","type":"string","optional":true,"description":"校验提示","defaultValue":"'输入内容不正确'"},{"name":"showErr","type":"boolean","optional":true,"description":"校验提示","defaultValue":"false","values":[false,true]},{"name":"beforeConfirm","type":"(value: string) => boolean | Promise<boolean>","optional":true,"description":"(string)=>boolean或Promise<boolean>;false拦截,异常显示可重试错误"},{"name":"icon","type":"string","optional":true,"description":"公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址"},{"name":"iconColor","type":"string","optional":true,"description":"公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址"},{"name":"headerImage","type":"string","optional":true,"description":"公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"遮罩关闭 / 关闭按钮","defaultValue":"false","values":[false,true]},{"name":"showClose","type":"boolean","optional":true,"description":"遮罩关闭 / 关闭按钮","defaultValue":"false","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"层级 / 懒挂载","defaultValue":"99"},{"name":"lazyRender","type":"boolean","optional":true,"description":"层级 / 懒挂载","defaultValue":"true","values":[false,true]},{"name":"requestKey","type":"number","optional":true,"description":"useDialog内部请求编号,替换请求时使旧确认失效","defaultValue":"0"},{"name":"show","type":"boolean","optional":true,"description":"受控显示 / 关闭请求 / {action,value,index?}结果","defaultValue":"false","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"原生Portal,需Host","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"自定义样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"自定义样式"},{"name":"header","type":"ReactNode","optional":true,"description":"内容、头部、操作区;renderActions接收confirm/cancel/close/pending"}],"events":[{"name":"onChange","type":"(show: boolean) => void","optional":true,"description":"受控显示 / 关闭请求 / {action,value,index?}结果"},{"name":"onResult","type":"(result: DialogResult) => void","optional":true,"description":"受控显示 / 关闭请求 / {action,value,index?}结果"}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"ReactNode 标题 / 纯文本正文"},{"name":"children","type":"ReactNode","optional":true,"description":"内容、头部、操作区;renderActions接收confirm/cancel/close/pending"},{"name":"header","type":"ReactNode","optional":true,"description":"内容、头部、操作区;renderActions接收confirm/cancel/close/pending"},{"name":"renderActions","type":"(controls: { confirm: () => void; cancel: () => void; close: () => void; pending: boolean }) => ReactNode","optional":true,"description":"内容、头部、操作区;renderActions接收confirm/cancel/close/pending"}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","消息提醒"],"title":"消息提醒","section":"组件类型","description":"将 `useDialog()` 返回的 `props` 绑定到 `Dialog`,调用 `alert()` 显示提醒,通过 `title` 和 `msg` 设置内容。","language":"tsx","code":"import { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n","blocks":[{"language":"tsx","code":"import { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","确认操作"],"title":"确认操作","section":"组件类型","description":"调用 `confirm()` 显示确认对话框,用户确认时 Promise 完成,取消时进入拒绝分支。","language":"tsx","code":"const dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n","blocks":[{"language":"tsx","code":"const dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n"}]},{"name":"demo-3","aliases":["demo-3","按钮主题"],"title":"按钮主题","section":"组件样式","description":"设置 `theme=\"button\"` 使用按钮样式的操作区。","language":"tsx","code":"<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n","blocks":[{"language":"tsx","code":"<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n"}]}],"allowUnknownProps":false},{"name":"Divider","id":"divider","label":"Divider 分割线","category":"基础","categoryId":"basic","kind":"component","description":"分割线用于分隔内容区域,支持水平、垂直、虚线以及带文字或图标的分隔形式。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Divider.tsx","docPath":"docs/ui/components/divider.md","doc":"# Divider 分割线\n\n分割线用于分隔内容区域,支持水平、垂直、虚线以及带文字或图标的分隔形式。\n\n```tsx\nimport { Divider } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础分割线\n\n默认展示水平分割线,设置 `dashed` 使用虚线,子节点用于展示分隔文字。\n\n```tsx\n<Divider />\n<Divider dashed />\n<Divider>内容分隔</Divider>\n```\n\n## 组件样式\n\n### 颜色与位置\n\n通过 `color` 设置颜色,通过 `contentPosition` 设置内容的位置。\n\n```tsx\n<Divider color=\"#1c64fd\" contentPosition=\"left\">\n 左侧标题\n</Divider>\n```\n\n## 布局能力\n\n### 垂直分割线\n\n设置 `vertical` 使用垂直分割线,适合横向排列的操作项。\n\n```tsx\n<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <text>编辑</text>\n <Divider vertical />\n <text>删除</text>\n</view>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 中间内容,字符串/数值自动包入text;数值0保留 | `ReactNode` | — |\n| label | 兼容旧接口;children优先于label,contentPosition优先于align | `string` | — |\n| align | 兼容旧接口;children优先于label,contentPosition优先于align | `DividerAlign` | `'center'` |\n| contentPosition | 左右短线限制为可用宽度10% | `DividerAlign` | — |\n| color | 文字颜色,与官网行为一致;线条颜色使用--cso-ui-divider-line-color,ReactNode自行指定颜色 | `string` | — |\n| hairline | 水平scaleY(.5)、竖线scaleX(.5),保留布局尺寸 | `boolean` | `true` |\n| dashed | 虚线 | `boolean` | `false` |\n| vertical | 16px高的竖线;忽略children与label | `boolean` | `false` |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 中间内容,字符串/数值自动包入text;数值0保留 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type DividerAlign = 'left' | 'center' | 'right';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-divider-line-color` | 当前组件 |\n| `--cso-ui-divider-line-width` | 当前组件 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Divider 组件源码](./sources/divider/Divider.tsx.txt) · [示例源码](./sources/divider/demo.tsx.txt) · [文档源码](./sources/divider/docs.md.txt)\n","demoSource":"import { Divider, Icon } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function DividerExample() {\n return <view className=\"demo-divider-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><Divider /></ExampleBlock>\n <ExampleBlock title=\"展示文本\"><Divider>展示文本</Divider></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"内容位置\"><Divider>中间</Divider><Divider contentPosition=\"left\">左侧</Divider><Divider contentPosition=\"right\">右侧</Divider></ExampleBlock>\n <ExampleBlock title=\"虚线\"><Divider dashed>虚线分割</Divider></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义渲染内容\"><Divider><Icon name=\"down\" size={20} color=\"#868a9c\" /></Divider></ExampleBlock>\n <ExampleBlock title=\"自定义颜色\"><Divider color=\"#1c64fd\">自定义颜色</Divider></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"垂直分割线\"><view className=\"demo-divider-vertical\"><text>文本</text><Divider vertical /><text>文本</text><Divider vertical dashed /><text>文本</text><Divider vertical hairline={false} /><text>文本</text><Divider vertical color=\"#1c64fd\" /><text>文本</text></view></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"label","type":"string","optional":true,"description":"兼容旧接口;children优先于label,contentPosition优先于align"},{"name":"align","type":"DividerAlign","optional":true,"description":"兼容旧接口;children优先于label,contentPosition优先于align","defaultValue":"'center'","values":["left","right","center"]},{"name":"contentPosition","type":"DividerAlign","optional":true,"description":"左右短线限制为可用宽度10%","defaultValue":"align","values":["left","right","center"]},{"name":"color","type":"string","optional":true,"description":"文字颜色,与官网行为一致;线条颜色使用--cso-ui-divider-line-color,ReactNode自行指定颜色"},{"name":"hairline","type":"boolean","optional":true,"description":"水平scaleY(.5)、竖线scaleX(.5),保留布局尺寸","defaultValue":"true","values":[false,true]},{"name":"dashed","type":"boolean","optional":true,"description":"虚线","defaultValue":"false","values":[false,true]},{"name":"vertical","type":"boolean","optional":true,"description":"16px高的竖线;忽略children与label","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"中间内容,字符串/数值自动包入text;数值0保留"}],"methods":[],"cssVars":[{"name":"--cso-ui-divider-line-color","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-divider-line-width","defaultValue":"1px","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","基础分割线"],"title":"基础分割线","section":"组件类型","description":"默认展示水平分割线,设置 `dashed` 使用虚线,子节点用于展示分隔文字。","language":"tsx","code":"<Divider />\n<Divider dashed />\n<Divider>内容分隔</Divider>\n","blocks":[{"language":"tsx","code":"<Divider />\n<Divider dashed />\n<Divider>内容分隔</Divider>\n"}]},{"name":"demo-2","aliases":["demo-2","颜色与位置"],"title":"颜色与位置","section":"组件样式","description":"通过 `color` 设置颜色,通过 `contentPosition` 设置内容的位置。","language":"tsx","code":"<Divider color=\"#1c64fd\" contentPosition=\"left\">\n 左侧标题\n</Divider>\n","blocks":[{"language":"tsx","code":"<Divider color=\"#1c64fd\" contentPosition=\"left\">\n 左侧标题\n</Divider>\n"}]},{"name":"demo-3","aliases":["demo-3","垂直分割线"],"title":"垂直分割线","section":"布局能力","description":"设置 `vertical` 使用垂直分割线,适合横向排列的操作项。","language":"tsx","code":"<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <text>编辑</text>\n <Divider vertical />\n <text>删除</text>\n</view>\n","blocks":[{"language":"tsx","code":"<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <text>编辑</text>\n <Divider vertical />\n <text>删除</text>\n</view>\n"}]}],"allowUnknownProps":false},{"name":"DropMenu","id":"drop-menu","label":"DropMenu 下拉菜单","category":"反馈","categoryId":"feedback","kind":"component","description":"下拉菜单适合筛选和排序,由 DropMenu 容器与多个 DropMenuItem 组成。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/DropMenu.tsx","docPath":"docs/ui/components/drop-menu.md","doc":"# DropMenu 下拉菜单\n\n下拉菜单适合筛选和排序,由 DropMenu 容器与多个 DropMenuItem 组成。\n\n```tsx\nimport { DropMenu, DropMenuItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 单项筛选\n\n在 `DropMenu` 中放置 `DropMenuItem`,通过 `options` 配置选项,`value` 和 `onChange` 管理选中值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n```\n\n## 内容形态\n\n### 自定义筛选内容\n\n通过 `title` 设置菜单标题,子节点中放置自定义筛选内容。\n\n```tsx\n<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n```\n\n## Attributes 属性\n\n### DropMenu\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| zIndex | 浮层层级 | `number` | `12` |\n| direction | 布局或展开方向 | `'down' \\| 'up'` | `'down'` |\n| topOffset | 顶部偏移 | `number` | `0` |\n| modal | 是否显示遮罩 | `boolean` | `true` |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| duration | 动画或显示时长,单位 ms | `number` | `200` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n### DropMenuItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `DropMenuValue` | — |\n| defaultValue | 非受控模式的初始值 | `DropMenuValue` | — |\n| options | 选项配置 | `readonly DropMenuOption[]` | `[]` |\n| disabled | 是否禁用 | `boolean` | `false` |\n| title | 标题内容 | `string` | — |\n| icon | 图标内容 | `string` | `'caret-down'` |\n| iconSize | 图标尺寸 | `number` | `16` |\n| iconName | 状态图标类型 | `string` | `'check'` |\n| activeColor | 选中状态颜色 | `string` | — |\n| beforeToggle | 切换前校验 | `(event: { status: boolean }) => boolean \\| Promise<boolean>` | — |\n| valueKey | 选项值字段名 | `string` | `'value'` |\n| labelKey | 显示文案字段名 | `string` | `'label'` |\n| tipKey | 选项说明字段名 | `string` | `'tip'` |\n| popupClassName | 弹层类名 | `string` | `''` |\n| popupStyle | 弹层样式 | `CSSProperties` | — |\n| popupHeight | 弹层高度 | `string \\| number` | — |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| DropMenuItem.onChange | 值发生变化时触发 | (event: { value: DropMenuValue; selectedItem: DropMenuOption }) => void |\n| DropMenuItem.onOpen | 打开时触发 | () => void |\n| DropMenuItem.onOpened | 对应操作发生时触发 | () => void |\n| DropMenuItem.onClose | 关闭时触发 | () => void |\n| DropMenuItem.onClosed | 对应操作发生时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| DropMenu.children | 自定义内容 | ReactNode |\n| DropMenuItem.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| getShowPop | 调用实例方法 | () => boolean |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n| toggle | 调用实例方法 | () => void |\n\n## 数据类型\n\n```tsx\nexport type DropMenuValue = string | number;\n\nexport type DropMenuOption = Record<string, unknown>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[DropMenu 组件源码](./sources/drop-menu/DropMenu.tsx.txt) · [DropMenuItem 组件源码](./sources/drop-menu/DropMenu.tsx.txt) · [示例源码](./sources/drop-menu/demo.tsx.txt) · [文档源码](./sources/drop-menu/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { Button, Cell, Dialog, DropMenu, DropMenuItem, Slider, SortButton, useDialog } from 'daisu-ui';\nimport type { DropMenuItemProps, DropMenuItemRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst goods = [{ label: '全部商品', value: 0 }, { label: '新款商品', value: 1, tip: '这是补充信息' }, { label: '这是比较长的筛选条件这是比较长的筛选条件', value: 2 }];\nconst sorts = [{ label: '综合', value: 0 }, { label: '销量', value: 1 }, { label: '上架时间', value: 2 }];\n\nexport function DropMenuExample({ theme }: { theme: 'light' | 'dark' }) {\n const filter = useRef<DropMenuItemRef>(null);\n const dialog = useDialog();\n const common: Partial<DropMenuItemProps> = { rootPortal: true, popupClassName: 'ui-demo-page demo-drop-menu-popup', activeColor: theme === 'dark' ? '#5b90ff' : '#1c64fd' };\n return <view className=\"demo-drop-menu-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={1} options={goods} /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={0} options={goods} disabled /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"异步打开/关闭\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={0} options={goods} beforeToggle={({ status }) => dialog.confirm({ title: status ? '异步打开' : '异步关闭', msg: status ? '确定要打开下拉菜单吗' : '确定要关闭下拉菜单吗' }).then(() => true).catch(() => false)} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义菜单选项\" noPadding><view className=\"demo-drop-menu-custom\"><DropMenu style={{ flex: 1 }}><DropMenuItem {...common} defaultValue={0} options={goods} /></DropMenu><view className=\"demo-drop-menu-sort\"><SortButton title=\"上架时间\" /></view></view></ExampleBlock>\n <ExampleBlock title=\"自定义菜单图标\" noPadding><DropMenu><DropMenuItem {...common} title=\"地图\" icon=\"location\" iconSize={14} /></DropMenu></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"向上弹出\" noPadding><DropMenu direction=\"up\" topOffset={44}><DropMenuItem {...common} defaultValue={0} options={goods} /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock>\n <ExampleBlock title=\"自定义菜单内容\" noPadding><DropMenu direction=\"up\" topOffset={44}><DropMenuItem {...common} defaultValue={0} options={goods} /><DropMenuItem {...common} ref={filter} title=\"筛选\">\n <view className=\"demo-drop-menu-slider\"><Slider defaultValue={30} /></view>\n <Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" />\n <view className=\"demo-drop-menu-confirm\"><Button label=\"主要按钮\" block size=\"large\" onTap={() => filter.current?.close()} /></view>\n </DropMenuItem></DropMenu></ExampleBlock>\n </DemoGroup>\n <Dialog {...dialog.props} rootPortal className=\"ui-demo-page\" />\n </view>;\n}\n","props":[{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"12"},{"name":"direction","type":"'down' | 'up'","optional":true,"description":"布局或展开方向","defaultValue":"'down'","values":["down","up"]},{"name":"topOffset","type":"number","optional":true,"description":"顶部偏移","defaultValue":"0"},{"name":"modal","type":"boolean","optional":true,"description":"是否显示遮罩","defaultValue":"true","values":[false,true]},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"200"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"getShowPop","description":"调用实例方法","type":"() => boolean"},{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"},{"name":"toggle","description":"调用实例方法","type":"() => void"}],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","单项筛选"],"title":"单项筛选","section":"基础用法","description":"在 `DropMenu` 中放置 `DropMenuItem`,通过 `options` 配置选项,`value` 和 `onChange` 管理选中值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义筛选内容"],"title":"自定义筛选内容","section":"内容形态","description":"通过 `title` 设置菜单标题,子节点中放置自定义筛选内容。","language":"tsx","code":"<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n","blocks":[{"language":"tsx","code":"<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n"}]}],"allowUnknownProps":false},{"name":"DropMenuItem","id":"drop-menu","label":"DropMenu 下拉菜单","category":"反馈","categoryId":"feedback","kind":"component","description":"下拉菜单适合筛选和排序,由 DropMenu 容器与多个 DropMenuItem 组成。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/DropMenu.tsx","docPath":"docs/ui/components/drop-menu.md","doc":"# DropMenu 下拉菜单\n\n下拉菜单适合筛选和排序,由 DropMenu 容器与多个 DropMenuItem 组成。\n\n```tsx\nimport { DropMenu, DropMenuItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 单项筛选\n\n在 `DropMenu` 中放置 `DropMenuItem`,通过 `options` 配置选项,`value` 和 `onChange` 管理选中值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n```\n\n## 内容形态\n\n### 自定义筛选内容\n\n通过 `title` 设置菜单标题,子节点中放置自定义筛选内容。\n\n```tsx\n<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n```\n\n## Attributes 属性\n\n### DropMenu\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| zIndex | 浮层层级 | `number` | `12` |\n| direction | 布局或展开方向 | `'down' \\| 'up'` | `'down'` |\n| topOffset | 顶部偏移 | `number` | `0` |\n| modal | 是否显示遮罩 | `boolean` | `true` |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| duration | 动画或显示时长,单位 ms | `number` | `200` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n### DropMenuItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `DropMenuValue` | — |\n| defaultValue | 非受控模式的初始值 | `DropMenuValue` | — |\n| options | 选项配置 | `readonly DropMenuOption[]` | `[]` |\n| disabled | 是否禁用 | `boolean` | `false` |\n| title | 标题内容 | `string` | — |\n| icon | 图标内容 | `string` | `'caret-down'` |\n| iconSize | 图标尺寸 | `number` | `16` |\n| iconName | 状态图标类型 | `string` | `'check'` |\n| activeColor | 选中状态颜色 | `string` | — |\n| beforeToggle | 切换前校验 | `(event: { status: boolean }) => boolean \\| Promise<boolean>` | — |\n| valueKey | 选项值字段名 | `string` | `'value'` |\n| labelKey | 显示文案字段名 | `string` | `'label'` |\n| tipKey | 选项说明字段名 | `string` | `'tip'` |\n| popupClassName | 弹层类名 | `string` | `''` |\n| popupStyle | 弹层样式 | `CSSProperties` | — |\n| popupHeight | 弹层高度 | `string \\| number` | — |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| DropMenuItem.onChange | 值发生变化时触发 | (event: { value: DropMenuValue; selectedItem: DropMenuOption }) => void |\n| DropMenuItem.onOpen | 打开时触发 | () => void |\n| DropMenuItem.onOpened | 对应操作发生时触发 | () => void |\n| DropMenuItem.onClose | 关闭时触发 | () => void |\n| DropMenuItem.onClosed | 对应操作发生时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| DropMenu.children | 自定义内容 | ReactNode |\n| DropMenuItem.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| getShowPop | 调用实例方法 | () => boolean |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n| toggle | 调用实例方法 | () => void |\n\n## 数据类型\n\n```tsx\nexport type DropMenuValue = string | number;\n\nexport type DropMenuOption = Record<string, unknown>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[DropMenu 组件源码](./sources/drop-menu/DropMenu.tsx.txt) · [DropMenuItem 组件源码](./sources/drop-menu/DropMenu.tsx.txt) · [示例源码](./sources/drop-menu/demo.tsx.txt) · [文档源码](./sources/drop-menu/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { Button, Cell, Dialog, DropMenu, DropMenuItem, Slider, SortButton, useDialog } from 'daisu-ui';\nimport type { DropMenuItemProps, DropMenuItemRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst goods = [{ label: '全部商品', value: 0 }, { label: '新款商品', value: 1, tip: '这是补充信息' }, { label: '这是比较长的筛选条件这是比较长的筛选条件', value: 2 }];\nconst sorts = [{ label: '综合', value: 0 }, { label: '销量', value: 1 }, { label: '上架时间', value: 2 }];\n\nexport function DropMenuExample({ theme }: { theme: 'light' | 'dark' }) {\n const filter = useRef<DropMenuItemRef>(null);\n const dialog = useDialog();\n const common: Partial<DropMenuItemProps> = { rootPortal: true, popupClassName: 'ui-demo-page demo-drop-menu-popup', activeColor: theme === 'dark' ? '#5b90ff' : '#1c64fd' };\n return <view className=\"demo-drop-menu-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={1} options={goods} /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={0} options={goods} disabled /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"异步打开/关闭\" noPadding><DropMenu><DropMenuItem {...common} defaultValue={0} options={goods} beforeToggle={({ status }) => dialog.confirm({ title: status ? '异步打开' : '异步关闭', msg: status ? '确定要打开下拉菜单吗' : '确定要关闭下拉菜单吗' }).then(() => true).catch(() => false)} /></DropMenu></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义菜单选项\" noPadding><view className=\"demo-drop-menu-custom\"><DropMenu style={{ flex: 1 }}><DropMenuItem {...common} defaultValue={0} options={goods} /></DropMenu><view className=\"demo-drop-menu-sort\"><SortButton title=\"上架时间\" /></view></view></ExampleBlock>\n <ExampleBlock title=\"自定义菜单图标\" noPadding><DropMenu><DropMenuItem {...common} title=\"地图\" icon=\"location\" iconSize={14} /></DropMenu></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"向上弹出\" noPadding><DropMenu direction=\"up\" topOffset={44}><DropMenuItem {...common} defaultValue={0} options={goods} /><DropMenuItem {...common} defaultValue={0} options={sorts} /></DropMenu></ExampleBlock>\n <ExampleBlock title=\"自定义菜单内容\" noPadding><DropMenu direction=\"up\" topOffset={44}><DropMenuItem {...common} defaultValue={0} options={goods} /><DropMenuItem {...common} ref={filter} title=\"筛选\">\n <view className=\"demo-drop-menu-slider\"><Slider defaultValue={30} /></view>\n <Cell title=\"标题文字\" value=\"内容\" /><Cell title=\"标题文字\" description=\"描述信息\" value=\"内容\" />\n <view className=\"demo-drop-menu-confirm\"><Button label=\"主要按钮\" block size=\"large\" onTap={() => filter.current?.close()} /></view>\n </DropMenuItem></DropMenu></ExampleBlock>\n </DemoGroup>\n <Dialog {...dialog.props} rootPortal className=\"ui-demo-page\" />\n </view>;\n}\n","props":[{"name":"value","type":"DropMenuValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"DropMenuValue","optional":true,"description":"非受控模式的初始值"},{"name":"options","type":"readonly DropMenuOption[]","optional":true,"description":"选项配置","defaultValue":"[]"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","defaultValue":"false","values":[false,true]},{"name":"title","type":"string","optional":true,"description":"标题内容"},{"name":"icon","type":"string","optional":true,"description":"图标内容","defaultValue":"'caret-down'"},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸","defaultValue":"16"},{"name":"iconName","type":"string","optional":true,"description":"状态图标类型","defaultValue":"'check'"},{"name":"activeColor","type":"string","optional":true,"description":"选中状态颜色"},{"name":"beforeToggle","type":"(event: { status: boolean }) => boolean | Promise<boolean>","optional":true,"description":"切换前校验"},{"name":"valueKey","type":"string","optional":true,"description":"选项值字段名","defaultValue":"'value'"},{"name":"labelKey","type":"string","optional":true,"description":"显示文案字段名","defaultValue":"'label'"},{"name":"tipKey","type":"string","optional":true,"description":"选项说明字段名","defaultValue":"'tip'"},{"name":"popupClassName","type":"string","optional":true,"description":"弹层类名","defaultValue":"''"},{"name":"popupStyle","type":"CSSProperties","optional":true,"description":"弹层样式"},{"name":"popupHeight","type":"string | number","optional":true,"description":"弹层高度"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: DropMenuValue; selectedItem: DropMenuOption }) => void","optional":true,"description":""},{"name":"onOpen","type":"() => void","optional":true,"description":""},{"name":"onOpened","type":"() => void","optional":true,"description":""},{"name":"onClose","type":"() => void","optional":true,"description":""},{"name":"onClosed","type":"() => void","optional":true,"description":""}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"getShowPop","description":"调用实例方法","type":"() => boolean"},{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"},{"name":"toggle","description":"调用实例方法","type":"() => void"}],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","单项筛选"],"title":"单项筛选","section":"基础用法","description":"在 `DropMenu` 中放置 `DropMenuItem`,通过 `options` 配置选项,`value` 和 `onChange` 管理选中值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<DropMenu>\n <DropMenuItem\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n options={[\n { value: 0, label: '全部商品' },\n { value: 1, label: '新款商品' },\n ]}\n />\n</DropMenu>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义筛选内容"],"title":"自定义筛选内容","section":"内容形态","description":"通过 `title` 设置菜单标题,子节点中放置自定义筛选内容。","language":"tsx","code":"<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n","blocks":[{"language":"tsx","code":"<DropMenu>\n <DropMenuItem title=\"筛选\">\n <text>自定义筛选内容</text>\n </DropMenuItem>\n</DropMenu>\n"}]}],"allowUnknownProps":false},{"name":"Empty","id":"empty","label":"Empty 缺省提示","category":"反馈","categoryId":"feedback","kind":"component","description":"缺省提示用于展示无数据、网络异常或搜索无结果等状态,可组合图片、文案与底部操作。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Empty.tsx","docPath":"docs/ui/components/empty.md","doc":"# Empty 缺省提示\n\n缺省提示用于展示无数据、网络异常或搜索无结果等状态,可组合图片、文案与底部操作。\n\n```tsx\nimport { Empty } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 缺省状态\n\n通过 `icon` 设置缺省图标,通过 `tip` 设置提示文案。\n\n```tsx\n<Empty icon=\"no-content\" tip=\"暂无内容\" />\n```\n\n## 内容形态\n\n### 自定义图片和操作\n\n通过 `image` 自定义图片内容,通过 `bottom` 设置底部操作。\n\n```tsx\nimport { Icon, Button } from 'daisu-ui';\n\n<Empty\n image={<Icon name=\"no-result\" size={100} />}\n tip=\"未找到相关内容\"\n bottom={<Button label=\"重新搜索\" />}\n/>\n```\n\n## 组件样式\n\n### 图标尺寸\n\n通过 `iconSize` 设置缺省图标尺寸。\n\n```tsx\n<Empty icon=\"no-message\" tip=\"暂无消息\" iconSize={140} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| icon | 公共Icon名称,也可传位图URL、本地构建资源或SVG URL | `string` | `'empty'` |\n| iconSize | number或CSS长度字符串,数字按px,宽高相同 | `number \\| string` | `98` |\n| iconColor | 内置图标颜色;图片资源自身颜色保持原样 | `string` | — |\n| tip | string/ReactNode,默认16px/24px、字重600,距图标12px;未提供时不留文字间距 | `ReactNode` | — |\n| image | 自定义图片区域ReactNode,提供时替代icon,false可显式隐藏图标 | `ReactNode` | — |\n| bottom | 底部内容ReactNode,间距由调用者控制 | `ReactNode` | — |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| tip | string/ReactNode,默认16px/24px、字重600,距图标12px;未提供时不留文字间距 | ReactNode |\n| image | 自定义图片区域ReactNode,提供时替代icon,false可显式隐藏图标 | ReactNode |\n| bottom | 底部内容ReactNode,间距由调用者控制 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-empty-padding-bottom` | 当前组件 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Empty 组件源码](./sources/empty/Empty.tsx.txt) · [示例源码](./sources/empty/demo.tsx.txt) · [文档源码](./sources/empty/docs.md.txt)\n","demoSource":"import { Button, Empty, Icon, Toast, useToast } from 'daisu-ui';\nimport cat from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst cases = [\n {title:'搜索无结果',icon:'no-result',tip:'当前搜索无结果'},\n {title:'404页面',icon:'no-wifi',tip:'当前网络不可用,请检查你的网络设置'},\n {title:'页面暂无内容',icon:'no-content',tip:'暂无内容'},\n {title:'我的收藏为空',icon:'no-collection',tip:'暂无收藏'},\n {title:'我的评论为空',icon:'no-comment',tip:'暂无评论'},\n {title:'支付失败',icon:'failpayment',tip:'支付失败,请重新订购'},\n {title:'已订阅全部消息',icon:'no-message',tip:'已订阅全部消息'},\n];\nexport function EmptyExample() {\n const toast=useToast();\n return <view className=\"demo-empty-page\">\n <DemoGroup title=\"内容形态\">{cases.map(item=><ExampleBlock key={item.icon} title={item.title}><Empty icon={item.icon} tip={item.tip}/></ExampleBlock>)}</DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义大小\"><Empty icon=\"no-result\" iconSize={140} tip=\"当前搜索无结果\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"自定义图片\"><Empty icon={cat} tip=\"查看我的头像\"/></ExampleBlock>\n <ExampleBlock title=\"插槽自定义图片内容\"><Empty image={<Icon name=\"sun-fill\" size={100}/>} tip=\"插槽自定义图片内容\"/></ExampleBlock>\n <ExampleBlock title=\"底部插槽\"><Empty icon=\"no-content\" tip=\"当前搜索无结果\" bottom={<view className=\"demo-empty-bottom\"><Button tone=\"info\" label=\"重新加载\" onTap={()=>{ 'background only'; toast.info('已发起重新加载'); }}/></view>}/></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props}/>\n </view>;\n}\n","props":[{"name":"icon","type":"string","optional":true,"description":"公共Icon名称,也可传位图URL、本地构建资源或SVG URL","defaultValue":"'empty'"},{"name":"iconSize","type":"number | string","optional":true,"description":"number或CSS长度字符串,数字按px,宽高相同","defaultValue":"98"},{"name":"iconColor","type":"string","optional":true,"description":"内置图标颜色;图片资源自身颜色保持原样"},{"name":"tip","type":"ReactNode","optional":true,"description":"string/ReactNode,默认16px/24px、字重600,距图标12px;未提供时不留文字间距"},{"name":"image","type":"ReactNode","optional":true,"description":"自定义图片区域ReactNode,提供时替代icon,false可显式隐藏图标"},{"name":"bottom","type":"ReactNode","optional":true,"description":"底部内容ReactNode,间距由调用者控制"},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"tip","type":"ReactNode","optional":true,"description":"string/ReactNode,默认16px/24px、字重600,距图标12px;未提供时不留文字间距"},{"name":"image","type":"ReactNode","optional":true,"description":"自定义图片区域ReactNode,提供时替代icon,false可显式隐藏图标"},{"name":"bottom","type":"ReactNode","optional":true,"description":"底部内容ReactNode,间距由调用者控制"}],"methods":[],"cssVars":[{"name":"--cso-ui-empty-padding-bottom","defaultValue":"24px","description":""},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","缺省状态"],"title":"缺省状态","section":"组件类型","description":"通过 `icon` 设置缺省图标,通过 `tip` 设置提示文案。","language":"tsx","code":"<Empty icon=\"no-content\" tip=\"暂无内容\" />\n","blocks":[{"language":"tsx","code":"<Empty icon=\"no-content\" tip=\"暂无内容\" />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义图片和操作"],"title":"自定义图片和操作","section":"内容形态","description":"通过 `image` 自定义图片内容,通过 `bottom` 设置底部操作。","language":"tsx","code":"import { Icon, Button } from 'daisu-ui';\n\n<Empty\n image={<Icon name=\"no-result\" size={100} />}\n tip=\"未找到相关内容\"\n bottom={<Button label=\"重新搜索\" />}\n/>\n","blocks":[{"language":"tsx","code":"import { Icon, Button } from 'daisu-ui';\n\n<Empty\n image={<Icon name=\"no-result\" size={100} />}\n tip=\"未找到相关内容\"\n bottom={<Button label=\"重新搜索\" />}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","图标尺寸"],"title":"图标尺寸","section":"组件样式","description":"通过 `iconSize` 设置缺省图标尺寸。","language":"tsx","code":"<Empty icon=\"no-message\" tip=\"暂无消息\" iconSize={140} />\n","blocks":[{"language":"tsx","code":"<Empty icon=\"no-message\" tip=\"暂无消息\" iconSize={140} />\n"}]}],"allowUnknownProps":false},{"name":"EmptyState","id":"empty-state","label":"EmptyState","category":"公共 API","categoryId":"api","kind":"component","description":"EmptyState 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/EmptyState.tsx","doc":"","props":[{"name":"title","type":"string","optional":true,"description":"","defaultValue":"'暂无数据'"},{"name":"description","type":"string","optional":true,"description":""},{"name":"actionLabel","type":"string","optional":true,"description":""}],"events":[{"name":"onAction","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Fab","id":"fab","label":"Fab 悬浮按钮","category":"基础","categoryId":"basic","kind":"component","description":"悬浮按钮用于放置页面的主要操作。支持展开操作项、自定义触发器、位置和拖动。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Fab.tsx","docPath":"docs/ui/components/fab.md","doc":"# Fab 悬浮按钮\n\n悬浮按钮用于放置页面的主要操作。支持展开操作项、自定义触发器、位置和拖动。\n\n```tsx\nimport { Fab } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础用法\n\n通过 `onTap` 响应悬浮按钮点击。\n\n```tsx\n<Fab\n onTap={() => {\n 'background only';\n console.log('新建');\n }}\n/>\n```\n\n## 交互用法\n\n### 展开操作\n\n设置 `expandable` 支持展开操作项,子节点作为展开后的内容。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Fab expandable>\n <Button label=\"拍照\" size=\"small\" />\n <Button label=\"相册\" size=\"small\" />\n</Fab>\n```\n\n## 组件状态\n\n### 禁用与拖动\n\n设置 `disabled` 禁用按钮,设置 `draggable` 允许拖动位置。\n\n```tsx\n<Fab disabled />\n<Fab draggable />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| active | 当前步骤或激活状态 | `boolean` | — |\n| defaultActive | 非受控模式的初始展开状态 | `boolean` | `false` |\n| type | 类型 | `ButtonTone \\| 'default' \\| 'error'` | `'primary'` |\n| position | 显示位置 | `FabPosition` | `'right-bottom'` |\n| direction | 布局或展开方向 | `FabDirection` | `'top'` |\n| disabled | 是否禁用 | `boolean` | `false` |\n| draggable | 是否允许拖动 | `boolean` | `false` |\n| expandable | 是否允许展开子操作 | `boolean` | `true` |\n| inactiveIcon | 未激活状态图标 | `string` | `'add'` |\n| activeIcon | 激活状态图标 | `string` | `'close'` |\n| zIndex | 浮层层级 | `number` | `99` |\n| gap | 相邻操作项间距 | `FabGap` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n| trigger | trigger 配置 | `ReactNode \\| ((state: { active: boolean; disabled: boolean }) => ReactNode)` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onActiveChange | 对应操作发生时触发 | (active: boolean) => void |\n| onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n| trigger | 自定义区域内容 | ReactNode \\| ((state: { active: boolean; disabled: boolean }) => ReactNode) |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type ButtonTone =\n | 'primary'\n | 'success'\n | 'info'\n | 'warning'\n | 'danger'\n | 'neutral';\n\nexport type FabPosition =\n | 'left-top'\n | 'right-top'\n | 'left-bottom'\n | 'right-bottom'\n | 'left-center'\n | 'right-center'\n | 'top-center'\n | 'bottom-center';\n\nexport type FabDirection = 'top' | 'bottom' | 'left' | 'right';\n\nexport type FabGap = {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Fab 组件源码](./sources/fab/Fab.tsx.txt) · [示例源码](./sources/fab/demo.tsx.txt) · [文档源码](./sources/fab/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Switch, SwitchThumb, SwitchTrack } from '@lynx-js/lynx-ui';\nimport { Button, Fab, Icon } from 'daisu-ui';\nimport type { FabDirection, FabPosition, FabProps } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction Choices<T extends string>({ value, options, onChange }: { value: T; options: readonly (readonly [T,string])[]; onChange: (value:T)=>void }) {\n return <view className=\"demo-fab-choices\">{options.map(([id,label]) => <view key={id} className=\"demo-fab-choice\" accessibility-element accessibility-traits=\"button\" accessibility-label={label} bindtap={() => { 'background only'; onChange(id); }}><view className={`demo-fab-radio ${value===id?'demo-fab-radio-checked':''}`}>{value===id?<view />:null}</view><text>{label}</text></view>)}</view>;\n}\nfunction Toggle({ value, onChange, label }: { value: boolean; onChange:(value:boolean)=>void; label: string }) {\n return <view className=\"demo-fab-switch-row\" catchtap={() => { 'background only'; }}><Switch className=\"demo-fab-switch\" checked={value} onChange={onChange} switchProps={{'accessibility-label':label}}><SwitchTrack className=\"demo-fab-switch-track\"/><SwitchThumb className=\"demo-fab-switch-thumb\"/></Switch></view>;\n}\n\nexport function FabExample() {\n const [type,setType] = useState<NonNullable<FabProps['type']>>('primary');\n const [position,setPosition] = useState<FabPosition>('left-bottom');\n const [direction,setDirection] = useState<FabDirection>('top');\n const [disabled,setDisabled] = useState(false);\n const [draggable,setDraggable] = useState(false);\n const [active,setActive] = useState(false);\n const [custom,setCustom] = useState('default');\n const [notice,setNotice] = useState('');\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => clearTimeout(timer.current),[]);\n const toast = (message:string) => { 'background only'; clearTimeout(timer.current); setNotice(message); timer.current=setTimeout(()=>setNotice(''),1500); };\n const iconButton = (icon:string,tone:'primary'|'info'|'success'|'danger'|'warning',message:string,variant:'solid'|'plain'|'text'='solid') => <Button key={icon} className=\"demo-fab-action\" tone={tone} variant={variant} round disabled={disabled} icon={<Icon name={icon} size={22} color={variant==='solid'?'#fff':tone==='success'?'#12b886':tone==='warning'?'#f57f00':tone==='danger'?'#f14646':tone==='info'?'#868a9c':'#1c64fd'} />} onTap={()=>{ 'background only';toast(message); }} />;\n return <view className=\"demo-fab-page\" bindtap={()=>{ 'background only';setActive(false); }}>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"悬浮按钮主题色\"><Choices value={type} options={[[\"primary\",\"主要按钮\"],[\"success\",\"成功按钮\"],[\"warning\",\"警告按钮\"],[\"danger\",\"危险按钮\"],[\"info\",\"信息按钮\"]]} onChange={setType}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"悬浮按钮位置\"><Choices value={position} options={[[\"left-top\",\"左上\"],[\"right-top\",\"右上\"],[\"left-center\",\"左中\"],[\"right-center\",\"右中\"],[\"top-center\",\"上中\"],[\"bottom-center\",\"下中\"],[\"left-bottom\",\"左下\"],[\"right-bottom\",\"右下\"]]} onChange={setPosition}/></ExampleBlock>\n <ExampleBlock title=\"菜单弹出方向\"><Choices value={direction} options={[[\"top\",\"向上\"],[\"bottom\",\"向下\"],[\"right\",\"向右\"],[\"left\",\"向左\"]]} onChange={setDirection}/></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"禁用\"><Toggle label=\"禁用悬浮按钮\" value={disabled} onChange={setDisabled}/></ExampleBlock>\n <ExampleBlock title=\"可拖动\"><Toggle label=\"可拖动悬浮按钮\" value={draggable} onChange={setDraggable}/></ExampleBlock>\n <ExampleBlock title=\"切换展示\"><view className=\"demo-fab-inline\" catchtap={()=>{ 'background only'; }}><Button label=\"切换\" onTap={()=>{ 'background only';setActive(value=>!value); }}/></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"自定义触发器\"><view catchtap={()=>{ 'background only'; }}><Choices value={custom} options={[[\"default\",\"默认样式\"],[\"withText\",\"带文字按钮\"],[\"plain\",\"plain 变体\"],[\"text\",\"text 变体\"]]} onChange={value=>{ 'background only';setCustom(value);setActive(false); }}/></view></ExampleBlock></DemoGroup>\n {custom==='default'?<Fab key=\"default\" active={active} onActiveChange={setActive} disabled={disabled} draggable={draggable} type={type} position={position} direction={direction} gap={{top:60}}>{iconButton('heart-fill','primary','一键三连')}{iconButton('star','success','我要收藏')}{iconButton('gift','danger','我要投币')}{iconButton('thumb-up','warning','我要点赞')}</Fab>:custom==='withText'?<Fab key=\"withText\" disabled={disabled} draggable={draggable} position=\"left-bottom\" gap={{top:60}} expandable={false} trigger={<Button tone=\"danger\" label=\"分享给朋友\" disabled={disabled} icon={<Icon name=\"share-alt\" color=\"#fff\" size={18}/>} onTap={()=>{ 'background only';toast('分享给朋友'); }}/>} />:custom==='plain'?<Fab key=\"plain\" active={active} onActiveChange={setActive} disabled={disabled} draggable={draggable} position=\"right-bottom\" gap={{top:60}} trigger={<Button tone=\"primary\" variant=\"plain\" round disabled={disabled} icon={<Icon name=\"menu\" color=\"#1c64fd\" size={18}/>} />}>{iconButton('settings','info','设置','plain')}{iconButton('share-alt','success','分享','plain')}{iconButton('edit','warning','编辑','plain')}</Fab>:<Fab key=\"text\" active={active} onActiveChange={setActive} disabled={disabled} draggable={draggable} position=\"right-bottom\" direction=\"bottom\" gap={{top:60}} trigger={<Button tone=\"primary\" variant=\"text\" size=\"large\" round disabled={disabled} icon={<Icon name=\"heart-fill\" color=\"#1c64fd\" size={18}/>} />}>{iconButton('copy','info','复制','text')}{iconButton('delete','danger','删除','text')}</Fab>}\n {notice?<view className=\"demo-cell-toast\" user-interaction-enabled={false}><text>{notice}</text></view>:null}\n </view>;\n}\n","props":[{"name":"active","type":"boolean","optional":true,"description":"当前步骤或激活状态","values":[false,true]},{"name":"defaultActive","type":"boolean","optional":true,"description":"非受控模式的初始展开状态","defaultValue":"false","values":[false,true]},{"name":"type","type":"ButtonTone | 'default' | 'error'","optional":true,"description":"类型","defaultValue":"'primary'","values":["primary","success","info","warning","danger","neutral","error","default"]},{"name":"position","type":"FabPosition","optional":true,"description":"显示位置","defaultValue":"'right-bottom'","values":["left-top","right-top","left-bottom","right-bottom","left-center","right-center","top-center","bottom-center"]},{"name":"direction","type":"FabDirection","optional":true,"description":"布局或展开方向","defaultValue":"'top'","values":["bottom","left","right","top"]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","defaultValue":"false","values":[false,true]},{"name":"draggable","type":"boolean","optional":true,"description":"是否允许拖动","defaultValue":"false","values":[false,true]},{"name":"expandable","type":"boolean","optional":true,"description":"是否允许展开子操作","defaultValue":"true","values":[false,true]},{"name":"inactiveIcon","type":"string","optional":true,"description":"未激活状态图标","defaultValue":"'add'"},{"name":"activeIcon","type":"string","optional":true,"description":"激活状态图标","defaultValue":"'close'"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"99"},{"name":"gap","type":"FabGap","optional":true,"description":"相邻操作项间距","defaultValue":"{}"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"trigger","type":"ReactNode | ((state: { active: boolean; disabled: boolean }) => ReactNode)","optional":true,"description":"自定义区域内容"}],"events":[{"name":"onActiveChange","type":"(active: boolean) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"},{"name":"trigger","type":"ReactNode | ((state: { active: boolean; disabled: boolean }) => ReactNode)","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","基础用法"],"title":"基础用法","section":"组件类型","description":"通过 `onTap` 响应悬浮按钮点击。","language":"tsx","code":"<Fab\n onTap={() => {\n 'background only';\n console.log('新建');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Fab\n onTap={() => {\n 'background only';\n console.log('新建');\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","展开操作"],"title":"展开操作","section":"交互用法","description":"设置 `expandable` 支持展开操作项,子节点作为展开后的内容。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Fab expandable>\n <Button label=\"拍照\" size=\"small\" />\n <Button label=\"相册\" size=\"small\" />\n</Fab>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Fab expandable>\n <Button label=\"拍照\" size=\"small\" />\n <Button label=\"相册\" size=\"small\" />\n</Fab>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用与拖动"],"title":"禁用与拖动","section":"组件状态","description":"设置 `disabled` 禁用按钮,设置 `draggable` 允许拖动位置。","language":"tsx","code":"<Fab disabled />\n<Fab draggable />\n","blocks":[{"language":"tsx","code":"<Fab disabled />\n<Fab draggable />\n"}]}],"allowUnknownProps":false},{"name":"FloatingPanel","id":"floating-panel","label":"FloatingPanel 浮动面板","category":"反馈","categoryId":"feedback","kind":"component","description":"浮动面板在页面底部提供可拖动的内容区域,支持多档高度和内容拖拽。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FloatingPanel.tsx","docPath":"docs/ui/components/floating-panel.md","doc":"# FloatingPanel 浮动面板\n\n浮动面板在页面底部提供可拖动的内容区域,支持多档高度和内容拖拽。\n\n```tsx\nimport { FloatingPanel } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 多档高度\n\n通过 `anchors` 设置可停留的高度,`defaultHeight` 指定初始高度。\n\n```tsx\n<FloatingPanel anchors={[100, 300, 500]} defaultHeight={100}>\n <text>向上拖动查看更多内容</text>\n</FloatingPanel>\n```\n\n## 交互用法\n\n### 监听高度变化\n\n通过 `onHeightChange` 获取面板变化后的高度。\n\n```tsx\n<FloatingPanel\n anchors={[120, 360]}\n onHeightChange={(event) => {\n 'background only';\n console.log(event.height);\n }}\n>\n <text>面板内容</text>\n</FloatingPanel>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| height | 高度 | `number` | — |\n| defaultHeight | 面板初始高度 | `number` | `0` |\n| anchors | 可停留的面板高度列表,单位 px | `readonly number[]` | — |\n| duration | 动画或显示时长,单位 ms | `number` | `300` |\n| contentDraggable | 是否允许拖动内容区域调整高度 | `boolean` | `true` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `false` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n| showScrollbar | 是否显示滚动条 | `boolean` | `true` |\n| zIndex | 浮层层级 | `number` | `10` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onHeightChange | 对应操作发生时触发 | (event: { height: number }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n\n## 源代码\n\n[FloatingPanel 组件源码](./sources/floating-panel/FloatingPanel.tsx.txt) · [示例源码](./sources/floating-panel/demo.tsx.txt) · [文档源码](./sources/floating-panel/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, FloatingPanel, Resize, Tabs } from 'daisu-ui';\n\nconst options = [{ label: '基础用法', value: 'basic' }, { label: '自定义锚点', value: 'custom' }, { label: '仅头部拖拽', value: 'header' }];\nconst letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');\n\nexport function FloatingPanelExample() {\n const [tab, setTab] = useState('basic');\n const [viewportHeight, setViewportHeight] = useState(0);\n const [customHeight, setCustomHeight] = useState<number>();\n const anchors = [100, Math.round(viewportHeight * .4), Math.round(viewportHeight * .7)];\n const current = customHeight ?? anchors[1]!;\n return <view className=\"demo-floating-page\">\n <Resize className=\"demo-floating-viewport\" onResize={({ height }) => setViewportHeight(height)} />\n <view className=\"demo-floating-tabs\"><Tabs value={tab} options={options} onChange={setTab} /><view className=\"demo-floating-tabs-line\" style={{ left: `${(options.findIndex(option => option.value === tab) + .5) / 3 * 100}%` }} /></view>\n {viewportHeight > 0 ? tab === 'custom' ? <FloatingPanel key=\"custom\" anchors={anchors} height={current} onHeightChange={({ height }) => setCustomHeight(height)}><view className=\"demo-floating-inner\"><text>{`\"zi-ding-yi-mao-dian\" [ \"100px\", \"${anchors[1]}px\", \"${anchors[2]}px\" ] - ${Math.round(current)}px`}</text></view></FloatingPanel> : tab === 'header' ? <FloatingPanel key=\"header\" anchors={[100, Math.round(viewportHeight * .6)]} contentDraggable={false}><view className=\"demo-floating-inner\"><text>内容区不可以拖拽</text></view></FloatingPanel> : <FloatingPanel key=\"basic\" anchors={[100, Math.round(viewportHeight * .6)]}><CellGroup border>{letters.map((letter, index) => <Cell key={letter} title={letter} last={index === letters.length - 1} />)}</CellGroup></FloatingPanel> : null}\n </view>;\n}\n","props":[{"name":"height","type":"number","optional":true,"description":"高度"},{"name":"defaultHeight","type":"number","optional":true,"description":"面板初始高度","defaultValue":"0"},{"name":"anchors","type":"readonly number[]","optional":true,"description":"可停留的面板高度列表,单位 px"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"300"},{"name":"contentDraggable","type":"boolean","optional":true,"description":"是否允许拖动内容区域调整高度","defaultValue":"true","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"false","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"},{"name":"showScrollbar","type":"boolean","optional":true,"description":"是否显示滚动条","defaultValue":"true","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"10"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onHeightChange","type":"(event: { height: number }) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"}],"demos":[{"name":"basic","aliases":["demo-1","多档高度"],"title":"多档高度","section":"基础用法","description":"通过 `anchors` 设置可停留的高度,`defaultHeight` 指定初始高度。","language":"tsx","code":"<FloatingPanel anchors={[100, 300, 500]} defaultHeight={100}>\n <text>向上拖动查看更多内容</text>\n</FloatingPanel>\n","blocks":[{"language":"tsx","code":"<FloatingPanel anchors={[100, 300, 500]} defaultHeight={100}>\n <text>向上拖动查看更多内容</text>\n</FloatingPanel>\n"}]},{"name":"demo-2","aliases":["demo-2","监听高度变化"],"title":"监听高度变化","section":"交互用法","description":"通过 `onHeightChange` 获取面板变化后的高度。","language":"tsx","code":"<FloatingPanel\n anchors={[120, 360]}\n onHeightChange={(event) => {\n 'background only';\n console.log(event.height);\n }}\n>\n <text>面板内容</text>\n</FloatingPanel>\n","blocks":[{"language":"tsx","code":"<FloatingPanel\n anchors={[120, 360]}\n onHeightChange={(event) => {\n 'background only';\n console.log(event.height);\n }}\n>\n <text>面板内容</text>\n</FloatingPanel>\n"}]}],"allowUnknownProps":false},{"name":"Form","id":"form-detail","label":"Form 表单","category":"录入","categoryId":"form","kind":"component","description":"表单用于组织字段布局与校验。Form 管理数据模型和校验规则,FormItem 描述字段并承载输入控件。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Form.tsx","docPath":"docs/ui/components/form.md","doc":"# Form 表单\n\n表单用于组织字段布局与校验。Form 管理数据模型和校验规则,FormItem 描述字段并承载输入控件。\n\n```tsx\nimport { Form, FormItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 受控表单\n\n通过 `model` 绑定表单数据,`FormItem.prop` 对应字段路径,输入控件通过 `onChange` 更新数据。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n```\n\n## 校验用法\n\n### 提交时校验\n\n通过 `schema` 配置校验,在提交时调用 `ref.validate()`,检查结果中的 `valid` 后再处理数据。\n\n```tsx\nimport { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n```\n\n## 组件状态\n\n### 整体禁用\n\n设置 `Form.disabled`,表单中的关联控件统一进入禁用状态。\n\n```tsx\n<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n```\n\n## Attributes 属性\n\n### Form\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | — |\n| border | 是否显示边框 | `boolean` | — |\n| center | 标题与内容是否垂直居中 | `boolean` | — |\n| size | 尺寸 | `'medium' \\| 'large'` | — |\n| titleWidth | 标题区域宽度 | `number \\| string` | — |\n| layout | 排列方式 | `'horizontal' \\| 'vertical'` | — |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | — |\n| asteriskPosition | 必填标记位置 | `'start' \\| 'end'` | — |\n| hideAsterisk | 是否隐藏必填标记 | `boolean` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | — |\n| model | 受控表单数据对象 | `FormModel` | 必填 |\n| schema | 表单校验适配器 | `FormSchema` | — |\n| validateTrigger | 触发校验的时机 | `FormValidateTrigger \\| readonly FormValidateTrigger[]` | — |\n| resetOnChange | 数据变化时是否清除对应校验结果 | `boolean` | — |\n| errorType | 校验错误展示方式 | `'message' \\| 'toast' \\| 'none'` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n### FormItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | — |\n| border | 是否显示边框 | `boolean` | — |\n| center | 标题与内容是否垂直居中 | `boolean` | — |\n| size | 尺寸 | `'medium' \\| 'large'` | — |\n| titleWidth | 标题区域宽度 | `number \\| string` | — |\n| layout | 排列方式 | `'horizontal' \\| 'vertical'` | — |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | — |\n| asteriskPosition | 必填标记位置 | `'start' \\| 'end'` | — |\n| hideAsterisk | 是否隐藏必填标记 | `boolean` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | — |\n| prop | 字段路径 | `string` | — |\n| title | 标题内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `string \\| number` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| prefixIcon | 前置图标名称 | `string` | — |\n| iconSize | 图标尺寸 | `number` | `16` |\n| icon | 图标内容 | `ReactNode` | — |\n| label | 显示文案 | `string` | — |\n| required | 是否显示必填标记 | `boolean` | — |\n| validateTrigger | 触发校验的时机 | `FormProps['validateTrigger']` | — |\n| clickable | 是否显示可点击状态 | `boolean` | — |\n| isLink | 是否展示链接入口 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Form.onValidate | 对应操作发生时触发 | (result: FormValidateResult) => void |\n| Form.onValidateError | 对应操作发生时触发 | (error: unknown) => void |\n| FormItem.onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Form.children | 自定义内容 | ReactNode |\n| FormItem.title | 标题内容 | ReactNode |\n| FormItem.icon | 图标内容 | ReactNode |\n| FormItem.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| validate | 执行校验 | (prop?: string \\| readonly string[]) => Promise<FormValidateResult> |\n| reset | 重置状态 | (prop?: string \\| readonly string[]) => void |\n\n## 数据类型\n\n```tsx\nexport type FormModel = Record<string, unknown>;\n\nexport type FormSchema = {\n validate: (\n model: FormModel,\n ) => readonly FormSchemaIssue[] | Promise<readonly FormSchemaIssue[]>;\n isRequired?: (path: string) => boolean | undefined;\n};\n\nexport type FormValidateTrigger = 'submit' | 'change' | 'blur';\n\nexport type FormValidateResult = {\n valid: boolean;\n errors: FormError[];\n outOfDate?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-disabled` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[Form 组件源码](./sources/form-detail/Form.tsx.txt) · [FormItem 组件源码](./sources/form-detail/Form.tsx.txt) · [示例源码](./sources/form-detail/demo.tsx.txt) · [文档源码](./sources/form-detail/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Button, Form, FormItem, Input, Switch, Toast, useToast } from 'daisu-ui';\nimport type { FormRef, FormSchema } from 'daisu-ui';\nimport type { UiDemoComponent } from '../catalog.js';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst basicSchema: FormSchema = { validate(model) { const issues = []; if (!model.value1) issues.push({ path: 'value1', message: '请输入歪比巴卜' }); if (!model.value2) issues.push({ path: 'value2', message: '请输入沙卡拉卡' }); if (model.value1 !== model.value2) { issues.push({ path: 'value1', message: '两个输入框的内容必须一致' }, { path: 'value2', message: '两个输入框的内容必须一致' }); } return issues; } };\nconst hiddenSchema: FormSchema = { validate: m => ['visibleValue', 'hiddenValue'].filter(k => !m[k]).map(path => ({ path, message: `请输入${path === 'visibleValue' ? '可见' : '隐藏'}字段` })) };\nconst parentSchema: FormSchema = { validate: m => (m.user as { name: string }).name ? [] : [{ path: ['user', 'name'], message: '请输入用户名' }] };\nexport function FormExample({ onOpen }: { onOpen: (page: UiDemoComponent) => void }) {\n const [model, setModel] = useState({ value1: '', value2: '' }), [hidden, setHidden] = useState(false), [hiddenModel, setHiddenModel] = useState({ visibleValue: 'Daisu UI', hiddenValue: '' }), [parentModel, setParentModel] = useState({ user: { name: '' } });\n const basic = useRef<FormRef>(null), hiddenForm = useRef<FormRef>(null), parent = useRef<FormRef>(null), toast = useToast();\n const submit = (ref: { current: FormRef | null }) => { 'background only'; void ref.current?.validate().then(result => { if (result.valid) toast.success('校验通过'); }).catch(() => toast.error('校验失败,请重试')); };\n const footer = (ref: { current: FormRef | null }) => <view className=\"demo-form-footer\"><Button label=\"提交\" size=\"large\" block onTap={() => submit(ref)} /></view>;\n return <view className=\"demo-form-page\"><>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础表单\" noPadding><Form ref={basic} model={model} schema={basicSchema} titleWidth={100}>\n <FormItem title=\"歪比巴卜\" prop=\"value1\"><Input value={model.value1} placeholder=\"请输入歪比巴卜\" onChange={value1 => setModel(old => ({ ...old, value1 }))} /></FormItem>\n <FormItem title=\"沙卡拉卡\" prop=\"value2\"><Input value={model.value2} placeholder=\"请输入沙卡拉卡\" onChange={value2 => setModel(old => ({ ...old, value2 }))} /></FormItem>{footer(basic)}\n </Form></ExampleBlock>{['动态表单', '复杂表单'].map(label => <ExampleBlock title={label} key={label} noPadding><view className=\"demo-form-button-wrap\"><Button label={label} size=\"large\" block onTap={() => onOpen(label === '动态表单' ? 'form-dynamic' : label === '复杂表单' ? 'form-complex' : label === '校验提示方式' ? 'form-errors' : label === '禁用表单' ? 'form-disabled' : 'form-trigger')} /></view></ExampleBlock>)}</DemoGroup>\n <DemoGroup title=\"组件配置\">{['校验提示方式', '禁用表单', '校验触发时机'].map(label => <ExampleBlock title={label} key={label} noPadding><view className=\"demo-form-button-wrap\"><Button label={label} size=\"large\" block onTap={() => onOpen(label === '动态表单' ? 'form-dynamic' : label === '复杂表单' ? 'form-complex' : label === '校验提示方式' ? 'form-errors' : label === '禁用表单' ? 'form-disabled' : 'form-trigger')} /></view></ExampleBlock>)}\n <ExampleBlock title=\"隐藏字段校验\" noPadding><Form ref={hiddenForm} model={hiddenModel} schema={hiddenSchema} titleWidth={110}><FormItem title=\"显示隐藏字段\"><Switch value={hidden} size={20} onChange={({ value }) => setHidden(!!value)} /></FormItem><FormItem title=\"可见字段\" prop=\"visibleValue\"><Input value={hiddenModel.visibleValue} placeholder=\"请输入可见字段\" onChange={visibleValue => setHiddenModel(old => ({ ...old, visibleValue }))} /></FormItem>{hidden ? <FormItem title=\"隐藏字段\" prop=\"hiddenValue\"><Input value={hiddenModel.hiddenValue} placeholder=\"请输入隐藏字段\" onChange={hiddenValue => setHiddenModel(old => ({ ...old, hiddenValue }))} /></FormItem> : null}{footer(hiddenForm)}</Form></ExampleBlock>\n <ExampleBlock title=\"父路径校验\" noPadding><Form ref={parent} model={parentModel} schema={parentSchema} titleWidth={110}><FormItem title=\"用户名\" prop=\"user\"><Input value={parentModel.user.name} placeholder=\"请输入用户名\" onChange={name => setParentModel({ user: { name } })} /></FormItem>{footer(parent)}</Form></ExampleBlock>\n </DemoGroup></>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"border","type":"boolean","optional":true,"description":"是否显示边框","values":[false,true]},{"name":"center","type":"boolean","optional":true,"description":"标题与内容是否垂直居中","values":[false,true]},{"name":"size","type":"'medium' | 'large'","optional":true,"description":"尺寸","values":["medium","large"]},{"name":"titleWidth","type":"number | string","optional":true,"description":"标题区域宽度"},{"name":"layout","type":"'horizontal' | 'vertical'","optional":true,"description":"排列方式","values":["vertical","horizontal"]},{"name":"valueAlign","type":"'left' | 'center' | 'right'","optional":true,"description":"值区域对齐方式","values":["left","right","center"]},{"name":"asteriskPosition","type":"'start' | 'end'","optional":true,"description":"必填标记位置","values":["start","end"]},{"name":"hideAsterisk","type":"boolean","optional":true,"description":"是否隐藏必填标记","values":[false,true]},{"name":"ellipsis","type":"boolean","optional":true,"description":"是否截断超出范围的文字","values":[false,true]},{"name":"model","type":"FormModel","optional":false,"description":"受控表单数据对象","defaultValue":"必填"},{"name":"schema","type":"FormSchema","optional":true,"description":"表单校验适配器"},{"name":"validateTrigger","type":"FormValidateTrigger | readonly FormValidateTrigger[]","optional":true,"description":"触发校验的时机"},{"name":"resetOnChange","type":"boolean","optional":true,"description":"数据变化时是否清除对应校验结果","values":[false,true]},{"name":"errorType","type":"'message' | 'toast' | 'none'","optional":true,"description":"校验错误展示方式","values":["none","message","toast"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onValidate","type":"(result: FormValidateResult) => void","optional":true,"description":""},{"name":"onValidateError","type":"(error: unknown) => void","optional":true,"description":""}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"validate","description":"执行校验","type":"(prop?: string | readonly string[]) => Promise<FormValidateResult>"},{"name":"reset","description":"重置状态","type":"(prop?: string | readonly string[]) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","受控表单"],"title":"受控表单","section":"基础用法","description":"通过 `model` 绑定表单数据,`FormItem.prop` 对应字段路径,输入控件通过 `onChange` 更新数据。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n"}]},{"name":"demo-2","aliases":["demo-2","提交时校验"],"title":"提交时校验","section":"校验用法","description":"通过 `schema` 配置校验,在提交时调用 `ref.validate()`,检查结果中的 `valid` 后再处理数据。","language":"tsx","code":"import { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","整体禁用"],"title":"整体禁用","section":"组件状态","description":"设置 `Form.disabled`,表单中的关联控件统一进入禁用状态。","language":"tsx","code":"<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n","blocks":[{"language":"tsx","code":"<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n"}]}],"allowUnknownProps":false},{"name":"FormFieldRow","id":"form-field-row","label":"FormFieldRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormFieldRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""}],"events":[],"slots":[{"name":"children","type":"JSX.Element","optional":false,"description":""}],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"FormInputRow","id":"form-input-row","label":"FormInputRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormInputRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"maxlength","type":"number","optional":true,"description":""},{"name":"placeholder","type":"string","optional":true,"description":"","defaultValue":"'请输入'"},{"name":"clearable","type":"boolean","optional":true,"description":"","defaultValue":"true","values":[false,true]}],"events":[{"name":"onInput","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"FormItem","id":"form-detail","label":"Form 表单","category":"录入","categoryId":"form","kind":"component","description":"表单用于组织字段布局与校验。Form 管理数据模型和校验规则,FormItem 描述字段并承载输入控件。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Form.tsx","docPath":"docs/ui/components/form.md","doc":"# Form 表单\n\n表单用于组织字段布局与校验。Form 管理数据模型和校验规则,FormItem 描述字段并承载输入控件。\n\n```tsx\nimport { Form, FormItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 受控表单\n\n通过 `model` 绑定表单数据,`FormItem.prop` 对应字段路径,输入控件通过 `onChange` 更新数据。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n```\n\n## 校验用法\n\n### 提交时校验\n\n通过 `schema` 配置校验,在提交时调用 `ref.validate()`,检查结果中的 `valid` 后再处理数据。\n\n```tsx\nimport { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n```\n\n## 组件状态\n\n### 整体禁用\n\n设置 `Form.disabled`,表单中的关联控件统一进入禁用状态。\n\n```tsx\n<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n```\n\n## Attributes 属性\n\n### Form\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | — |\n| border | 是否显示边框 | `boolean` | — |\n| center | 标题与内容是否垂直居中 | `boolean` | — |\n| size | 尺寸 | `'medium' \\| 'large'` | — |\n| titleWidth | 标题区域宽度 | `number \\| string` | — |\n| layout | 排列方式 | `'horizontal' \\| 'vertical'` | — |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | — |\n| asteriskPosition | 必填标记位置 | `'start' \\| 'end'` | — |\n| hideAsterisk | 是否隐藏必填标记 | `boolean` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | — |\n| model | 受控表单数据对象 | `FormModel` | 必填 |\n| schema | 表单校验适配器 | `FormSchema` | — |\n| validateTrigger | 触发校验的时机 | `FormValidateTrigger \\| readonly FormValidateTrigger[]` | — |\n| resetOnChange | 数据变化时是否清除对应校验结果 | `boolean` | — |\n| errorType | 校验错误展示方式 | `'message' \\| 'toast' \\| 'none'` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n### FormItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | — |\n| border | 是否显示边框 | `boolean` | — |\n| center | 标题与内容是否垂直居中 | `boolean` | — |\n| size | 尺寸 | `'medium' \\| 'large'` | — |\n| titleWidth | 标题区域宽度 | `number \\| string` | — |\n| layout | 排列方式 | `'horizontal' \\| 'vertical'` | — |\n| valueAlign | 值区域对齐方式 | `'left' \\| 'center' \\| 'right'` | — |\n| asteriskPosition | 必填标记位置 | `'start' \\| 'end'` | — |\n| hideAsterisk | 是否隐藏必填标记 | `boolean` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | — |\n| prop | 字段路径 | `string` | — |\n| title | 标题内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `string \\| number` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| prefixIcon | 前置图标名称 | `string` | — |\n| iconSize | 图标尺寸 | `number` | `16` |\n| icon | 图标内容 | `ReactNode` | — |\n| label | 显示文案 | `string` | — |\n| required | 是否显示必填标记 | `boolean` | — |\n| validateTrigger | 触发校验的时机 | `FormProps['validateTrigger']` | — |\n| clickable | 是否显示可点击状态 | `boolean` | — |\n| isLink | 是否展示链接入口 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Form.onValidate | 对应操作发生时触发 | (result: FormValidateResult) => void |\n| Form.onValidateError | 对应操作发生时触发 | (error: unknown) => void |\n| FormItem.onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Form.children | 自定义内容 | ReactNode |\n| FormItem.title | 标题内容 | ReactNode |\n| FormItem.icon | 图标内容 | ReactNode |\n| FormItem.children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| validate | 执行校验 | (prop?: string \\| readonly string[]) => Promise<FormValidateResult> |\n| reset | 重置状态 | (prop?: string \\| readonly string[]) => void |\n\n## 数据类型\n\n```tsx\nexport type FormModel = Record<string, unknown>;\n\nexport type FormSchema = {\n validate: (\n model: FormModel,\n ) => readonly FormSchemaIssue[] | Promise<readonly FormSchemaIssue[]>;\n isRequired?: (path: string) => boolean | undefined;\n};\n\nexport type FormValidateTrigger = 'submit' | 'change' | 'blur';\n\nexport type FormValidateResult = {\n valid: boolean;\n errors: FormError[];\n outOfDate?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-disabled` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[Form 组件源码](./sources/form-detail/Form.tsx.txt) · [FormItem 组件源码](./sources/form-detail/Form.tsx.txt) · [示例源码](./sources/form-detail/demo.tsx.txt) · [文档源码](./sources/form-detail/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Button, Form, FormItem, Input, Switch, Toast, useToast } from 'daisu-ui';\nimport type { FormRef, FormSchema } from 'daisu-ui';\nimport type { UiDemoComponent } from '../catalog.js';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst basicSchema: FormSchema = { validate(model) { const issues = []; if (!model.value1) issues.push({ path: 'value1', message: '请输入歪比巴卜' }); if (!model.value2) issues.push({ path: 'value2', message: '请输入沙卡拉卡' }); if (model.value1 !== model.value2) { issues.push({ path: 'value1', message: '两个输入框的内容必须一致' }, { path: 'value2', message: '两个输入框的内容必须一致' }); } return issues; } };\nconst hiddenSchema: FormSchema = { validate: m => ['visibleValue', 'hiddenValue'].filter(k => !m[k]).map(path => ({ path, message: `请输入${path === 'visibleValue' ? '可见' : '隐藏'}字段` })) };\nconst parentSchema: FormSchema = { validate: m => (m.user as { name: string }).name ? [] : [{ path: ['user', 'name'], message: '请输入用户名' }] };\nexport function FormExample({ onOpen }: { onOpen: (page: UiDemoComponent) => void }) {\n const [model, setModel] = useState({ value1: '', value2: '' }), [hidden, setHidden] = useState(false), [hiddenModel, setHiddenModel] = useState({ visibleValue: 'Daisu UI', hiddenValue: '' }), [parentModel, setParentModel] = useState({ user: { name: '' } });\n const basic = useRef<FormRef>(null), hiddenForm = useRef<FormRef>(null), parent = useRef<FormRef>(null), toast = useToast();\n const submit = (ref: { current: FormRef | null }) => { 'background only'; void ref.current?.validate().then(result => { if (result.valid) toast.success('校验通过'); }).catch(() => toast.error('校验失败,请重试')); };\n const footer = (ref: { current: FormRef | null }) => <view className=\"demo-form-footer\"><Button label=\"提交\" size=\"large\" block onTap={() => submit(ref)} /></view>;\n return <view className=\"demo-form-page\"><>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础表单\" noPadding><Form ref={basic} model={model} schema={basicSchema} titleWidth={100}>\n <FormItem title=\"歪比巴卜\" prop=\"value1\"><Input value={model.value1} placeholder=\"请输入歪比巴卜\" onChange={value1 => setModel(old => ({ ...old, value1 }))} /></FormItem>\n <FormItem title=\"沙卡拉卡\" prop=\"value2\"><Input value={model.value2} placeholder=\"请输入沙卡拉卡\" onChange={value2 => setModel(old => ({ ...old, value2 }))} /></FormItem>{footer(basic)}\n </Form></ExampleBlock>{['动态表单', '复杂表单'].map(label => <ExampleBlock title={label} key={label} noPadding><view className=\"demo-form-button-wrap\"><Button label={label} size=\"large\" block onTap={() => onOpen(label === '动态表单' ? 'form-dynamic' : label === '复杂表单' ? 'form-complex' : label === '校验提示方式' ? 'form-errors' : label === '禁用表单' ? 'form-disabled' : 'form-trigger')} /></view></ExampleBlock>)}</DemoGroup>\n <DemoGroup title=\"组件配置\">{['校验提示方式', '禁用表单', '校验触发时机'].map(label => <ExampleBlock title={label} key={label} noPadding><view className=\"demo-form-button-wrap\"><Button label={label} size=\"large\" block onTap={() => onOpen(label === '动态表单' ? 'form-dynamic' : label === '复杂表单' ? 'form-complex' : label === '校验提示方式' ? 'form-errors' : label === '禁用表单' ? 'form-disabled' : 'form-trigger')} /></view></ExampleBlock>)}\n <ExampleBlock title=\"隐藏字段校验\" noPadding><Form ref={hiddenForm} model={hiddenModel} schema={hiddenSchema} titleWidth={110}><FormItem title=\"显示隐藏字段\"><Switch value={hidden} size={20} onChange={({ value }) => setHidden(!!value)} /></FormItem><FormItem title=\"可见字段\" prop=\"visibleValue\"><Input value={hiddenModel.visibleValue} placeholder=\"请输入可见字段\" onChange={visibleValue => setHiddenModel(old => ({ ...old, visibleValue }))} /></FormItem>{hidden ? <FormItem title=\"隐藏字段\" prop=\"hiddenValue\"><Input value={hiddenModel.hiddenValue} placeholder=\"请输入隐藏字段\" onChange={hiddenValue => setHiddenModel(old => ({ ...old, hiddenValue }))} /></FormItem> : null}{footer(hiddenForm)}</Form></ExampleBlock>\n <ExampleBlock title=\"父路径校验\" noPadding><Form ref={parent} model={parentModel} schema={parentSchema} titleWidth={110}><FormItem title=\"用户名\" prop=\"user\"><Input value={parentModel.user.name} placeholder=\"请输入用户名\" onChange={name => setParentModel({ user: { name } })} /></FormItem>{footer(parent)}</Form></ExampleBlock>\n </DemoGroup></>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"border","type":"boolean","optional":true,"description":"是否显示边框","values":[false,true]},{"name":"center","type":"boolean","optional":true,"description":"标题与内容是否垂直居中","values":[false,true]},{"name":"size","type":"'medium' | 'large'","optional":true,"description":"尺寸","values":["medium","large"]},{"name":"titleWidth","type":"number | string","optional":true,"description":"标题区域宽度"},{"name":"layout","type":"'horizontal' | 'vertical'","optional":true,"description":"排列方式","values":["vertical","horizontal"]},{"name":"valueAlign","type":"'left' | 'center' | 'right'","optional":true,"description":"值区域对齐方式","values":["left","right","center"]},{"name":"asteriskPosition","type":"'start' | 'end'","optional":true,"description":"必填标记位置","values":["start","end"]},{"name":"hideAsterisk","type":"boolean","optional":true,"description":"是否隐藏必填标记","values":[false,true]},{"name":"ellipsis","type":"boolean","optional":true,"description":"是否截断超出范围的文字","values":[false,true]},{"name":"prop","type":"string","optional":true,"description":"字段路径"},{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"value","type":"string | number","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示"},{"name":"prefixIcon","type":"string","optional":true,"description":"前置图标名称"},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸","defaultValue":"16"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"},{"name":"label","type":"string","optional":true,"description":"显示文案"},{"name":"required","type":"boolean","optional":true,"description":"是否显示必填标记","values":[false,true]},{"name":"validateTrigger","type":"FormProps['validateTrigger']","optional":true,"description":"触发校验的时机"},{"name":"clickable","type":"boolean","optional":true,"description":"是否显示可点击状态","values":[false,true]},{"name":"isLink","type":"boolean","optional":true,"description":"是否展示链接入口","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":""}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"validate","description":"执行校验","type":"(prop?: string | readonly string[]) => Promise<FormValidateResult>"},{"name":"reset","description":"重置状态","type":"(prop?: string | readonly string[]) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","受控表单"],"title":"受控表单","section":"基础用法","description":"通过 `model` 绑定表单数据,`FormItem.prop` 对应字段路径,输入控件通过 `onChange` 更新数据。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Input } from 'daisu-ui';\n\nconst [model, setModel] = useState({ name: '' });\n\n<Form model={model} border>\n <FormItem title=\"姓名\" prop=\"name\" required>\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n"}]},{"name":"demo-2","aliases":["demo-2","提交时校验"],"title":"提交时校验","section":"校验用法","description":"通过 `schema` 配置校验,在提交时调用 `ref.validate()`,检查结果中的 `valid` 后再处理数据。","language":"tsx","code":"import { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useRef } from '@lynx-js/react';\n\nimport type { FormRef, FormSchema } from 'daisu-ui';\n\nimport { Button } from 'daisu-ui';\n\nconst form = useRef<FormRef>(null);\n\nconst [model, setModel] = useState({ name: '' });\n\nconst schema: FormSchema = {\n validate: (data) =>\n data.name ? [] : [{ path: 'name', message: '请输入姓名' }],\n};\n\n<Form ref={form} model={model} schema={schema}>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input\n value={model.name}\n onChange={(name) => {\n 'background only';\n setModel({ name });\n }}\n />\n </FormItem>\n</Form>\n<Button\n label=\"提交\"\n onTap={async () => {\n 'background only';\n const result = await form.current?.validate();\n if (result?.valid) console.log(model);\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","整体禁用"],"title":"整体禁用","section":"组件状态","description":"设置 `Form.disabled`,表单中的关联控件统一进入禁用状态。","language":"tsx","code":"<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n","blocks":[{"language":"tsx","code":"<Form model={{ name: '张三' }} disabled>\n <FormItem title=\"姓名\" prop=\"name\">\n <Input value=\"张三\" />\n </FormItem>\n</Form>\n"}]}],"allowUnknownProps":false},{"name":"FormNumberRow","id":"form-number-row","label":"FormNumberRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormNumberRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"min","type":"number","optional":true,"description":""},{"name":"max","type":"number","optional":true,"description":""},{"name":"step","type":"number","optional":true,"description":""}],"events":[{"name":"onChange","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"FormRadioRow","id":"form-radio-row","label":"FormRadioRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormRadioRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"options","type":"RadioOption[]","optional":false,"description":""}],"events":[{"name":"onChange","type":"(value: string) => void","optional":false,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"FormSelectRow","id":"form-select-row","label":"FormSelectRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormSelectRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":true,"description":""},{"name":"placeholder","type":"string","optional":false,"description":""},{"name":"clearable","type":"boolean","optional":true,"description":"","defaultValue":"true","values":[false,true]}],"events":[{"name":"onTap","type":"() => void","optional":false,"description":""},{"name":"onClear","type":"() => void","optional":false,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"FormTextareaRow","id":"form-textarea-row","label":"FormTextareaRow","category":"公共 API","categoryId":"api","kind":"component","description":"FormTextareaRow 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/FormFieldRow.tsx","doc":"","props":[{"name":"label","type":"string","optional":false,"description":""},{"name":"required","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"last","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]},{"name":"error","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"maxlength","type":"number","optional":true,"description":"","defaultValue":"2000"},{"name":"maxlines","type":"number","optional":true,"description":"","defaultValue":"6"},{"name":"placeholder","type":"string","optional":true,"description":"","defaultValue":"'请输入'"},{"name":"showWordLimit","type":"boolean","optional":true,"description":"","defaultValue":"true","values":[false,true]}],"events":[{"name":"onInput","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Gap","id":"gap","label":"Gap 间隔槽","category":"数据展示","categoryId":"display","kind":"component","description":"间隔槽用于在内容块之间保留指定高度,也可为底部安全区提供占位。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Gap.tsx","docPath":"docs/ui/components/gap.md","doc":"# Gap 间隔槽\n\n间隔槽用于在内容块之间保留指定高度,也可为底部安全区提供占位。\n\n```tsx\nimport { Gap } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 内容间隔\n\n通过 `height` 设置内容块之间的间隔高度。\n\n```tsx\n<text>上方内容</text>\n<Gap height={20} />\n<text>下方内容</text>\n```\n\n## 组件样式\n\n### 背景颜色\n\n通过 `bgColor` 设置间隔槽背景色。\n\n```tsx\n<Gap height={12} bgColor=\"#f7f8fa\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| height | 数值与纯数字字符串为px;rpx换算vw,其余合法Lynx CSS长度原样传递 | `number \\| string` | `14` |\n| bgColor | 背景色,未传时允许className覆盖 | `string` | — |\n| safeAreaBottom | 在原高度上追加底部安全区 | `boolean` | `false` |\n| bottomSafeAreaHeight | 宿主注入的底部安全区px值;负数/非有限数取0 | `number` | `0` |\n| className | 根节点定制,style优先 | `string` | `''` |\n| style | 根节点定制,style优先 | `CSSProperties` | — |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Gap 组件源码](./sources/gap/Gap.tsx.txt) · [示例源码](./sources/gap/demo.tsx.txt) · [文档源码](./sources/gap/docs.md.txt)\n","demoSource":"import { Gap } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function GapExample() {\n return <view className=\"demo-gap-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本使用\"><Gap bgColor=\"var(--cso-ui-danger)\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"自定义背景颜色\"><Gap bgColor=\"var(--cso-ui-primary)\" /></ExampleBlock>\n <ExampleBlock title=\"自定义高度\"><Gap bgColor=\"var(--cso-ui-primary)\" height=\"120rpx\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义样式\"><Gap className=\"demo-gap-custom\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\" />\n <view className=\"demo-gap-bottom\"><ExampleBlock title=\"底部安全区\"><Gap bgColor=\"var(--cso-ui-surface)\" height=\"120rpx\" safeAreaBottom /></ExampleBlock></view>\n </view>;\n}\n","props":[{"name":"height","type":"number | string","optional":true,"description":"数值与纯数字字符串为px;rpx换算vw,其余合法Lynx CSS长度原样传递","defaultValue":"14"},{"name":"bgColor","type":"string","optional":true,"description":"背景色,未传时允许className覆盖"},{"name":"safeAreaBottom","type":"boolean","optional":true,"description":"在原高度上追加底部安全区","defaultValue":"false","values":[false,true]},{"name":"bottomSafeAreaHeight","type":"number","optional":true,"description":"宿主注入的底部安全区px值;负数/非有限数取0","defaultValue":"0"},{"name":"className","type":"string","optional":true,"description":"根节点定制,style优先","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点定制,style优先"}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","内容间隔"],"title":"内容间隔","section":"基础用法","description":"通过 `height` 设置内容块之间的间隔高度。","language":"tsx","code":"<text>上方内容</text>\n<Gap height={20} />\n<text>下方内容</text>\n","blocks":[{"language":"tsx","code":"<text>上方内容</text>\n<Gap height={20} />\n<text>下方内容</text>\n"}]},{"name":"demo-2","aliases":["demo-2","背景颜色"],"title":"背景颜色","section":"组件样式","description":"通过 `bgColor` 设置间隔槽背景色。","language":"tsx","code":"<Gap height={12} bgColor=\"#f7f8fa\" />\n","blocks":[{"language":"tsx","code":"<Gap height={12} bgColor=\"#f7f8fa\" />\n"}]}],"allowUnknownProps":false},{"name":"Grid","id":"grid","label":"Grid 宫格","category":"数据展示","categoryId":"display","kind":"component","description":"宫格用于展示一组并列入口,支持列数、边框、自定义内容和点击导航。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Grid.tsx","docPath":"docs/ui/components/grid.md","doc":"# Grid 宫格\n\n宫格用于展示一组并列入口,支持列数、边框、自定义内容和点击导航。\n\n```tsx\nimport { Grid, GridItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 图标入口\n\n通过 `Grid.column` 设置每行列数,通过 `GridItem.icon` 和 `text` 设置每个入口。\n\n```tsx\n<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n```\n\n## 布局能力\n\n### 四列宫格\n\n设置 `column={4}` 每行展示四项,设置 `border` 显示边框。\n\n```tsx\n<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n```\n\n## Attributes 属性\n\n### Grid\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| column | 每行列数 | `number` | — |\n| border | 是否显示边框 | `boolean` | `false` |\n| gutter | 栅格列间隔,单位 px | `number` | `0` |\n| square | 是否使用正方形布局 | `boolean` | `false` |\n| clickable | 是否显示可点击状态 | `boolean` | `false` |\n| bgColor | 背景颜色 | `string` | — |\n| hoverClass | 按压状态类名 | `string` | `''` |\n| center | 标题与内容是否垂直居中 | `boolean` | `true` |\n| direction | 布局或展开方向 | `'vertical'\\|'horizontal'` | `'vertical'` |\n| reverse | 是否反向显示 | `boolean` | `false` |\n| iconSize | 图标尺寸 | `number` | `32` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### GridItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `ReactNode` | — |\n| icon | 图标内容 | `string` | — |\n| iconColor | 图标颜色 | `string` | — |\n| iconSize | 图标尺寸 | `number` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| isDot | 是否显示圆点徽标 | `boolean` | — |\n| value | 当前值;传入后由调用方更新 | `string\\|number` | — |\n| max | 最大值或数量上限 | `number` | — |\n| type | 类型 | `BadgeProps['type']` | — |\n| badgeProps | 徽标属性配置 | `BadgeProps` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | `false` |\n| url | 跳转或媒体地址 | `string` | — |\n| linkType | 链接打开方式 | `'push'\\|'replace'` | `'push'` |\n| className | 根节点自定义类名 | `string` | `''` |\n| textClassName | 文字区域类名 | `string` | `''` |\n| iconClassName | 图标区域类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Grid.onNavigate | 对应操作发生时触发 | GridNavigation |\n| GridItem.onNavigate | 对应操作发生时触发 | GridNavigation |\n| GridItem.onItemClick | 对应操作发生时触发 | (event:TouchEvent)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Grid.children | 自定义内容 | ReactNode |\n| GridItem.text | 显示文字 | ReactNode |\n| GridItem.renderIcon | 自定义图标 | ReactNode |\n| GridItem.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type GridNavigation = (\n url: string,\n options: { replace: boolean },\n) => void;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Grid 组件源码](./sources/grid/Grid.tsx.txt) · [GridItem 组件源码](./sources/grid/Grid.tsx.txt) · [示例源码](./sources/grid/demo.tsx.txt) · [文档源码](./sources/grid/docs.md.txt)\n","demoSource":"import { Grid, GridItem } from 'daisu-ui';\nimport { useAppRouter } from '../../../app/router.js';\nimport cat from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst cells=(count:number)=>Array.from({length:count},(_,i)=><GridItem key={i} icon=\"image\" text=\"文字\"/>);\nconst horizontal=(reverse=false)=>['图标居'+(reverse?'右':'左'),'设置选项','卡券中心','订单列表'].map((text,i)=><GridItem key={i} icon={['image','settings','tag','list'][i]} text={text}/>);\nexport function GridExample(){\n const router=useAppRouter();\n return <view className=\"demo-grid-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><Grid clickable>{cells(4)}</Grid></ExampleBlock><ExampleBlock title=\"内容插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i}><image src={cat} className=\"demo-grid-image\" mode=\"scaleToFill\"/></GridItem>)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"自定义列数\" noPadding><Grid column={3}>{cells(6)}</Grid></ExampleBlock><ExampleBlock title=\"正方形格子\" noPadding><Grid square column={4} border gutter={10}>{cells(8)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义背景颜色\" noPadding><Grid bgColor=\"var(--cso-ui-canvas)\">{cells(4)}</Grid></ExampleBlock><ExampleBlock title=\"显示border\"><Grid column={3} border>{cells(6)}</Grid></ExampleBlock><ExampleBlock title=\"设定格间隙\" noPadding><Grid gutter={10} column={4}>{cells(8)}</Grid></ExampleBlock><ExampleBlock title=\"提示信息\" noPadding><Grid><GridItem isDot icon=\"gift\" text=\"文字\"/><GridItem value={100} max={99} icon=\"desktop\" text=\"文字\"/></Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\"><ExampleBlock title=\"横向布局\" noPadding><Grid direction=\"horizontal\" column={2}>{horizontal()}</Grid></ExampleBlock><ExampleBlock title=\"横向布局 + 图标调换\" noPadding><Grid direction=\"horizontal\" reverse column={2} border>{horizontal(true)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"图标插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i} text=\"文字\" renderIcon={<image src={cat} className=\"demo-grid-slot-image\"/>}/>)}</Grid></ExampleBlock><ExampleBlock title=\"文字插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i} icon=\"image\" text={<text className=\"demo-grid-slot-text\">自定义文字插槽</text>} textClassName=\"demo-grid-custom-text\"/>)}</Grid></ExampleBlock><ExampleBlock title=\"自定义样式\" noPadding><Grid><GridItem ellipsis className=\"demo-grid-custom-item\" icon=\"search-line\" text=\"AI 友好的设计系统,提供 80+ 高质量组件,支持暗黑模式、国际化和自定义主题。\"/><GridItem ellipsis className=\"demo-grid-custom-item\" icon=\"settings\" text=\"基于Vue3+TS开发,提供80+高质量组件,支持暗黑模式、国际化和自定义主题。\"/></Grid></ExampleBlock><ExampleBlock title=\"页面导航\" noPadding><Grid clickable onNavigate={(_url,options)=>{ 'background only';void router.navigate({to:'/ui-demo/$page',params:{page:'button'},replace:options.replace});}}><GridItem url=\"/ui-demo/button\" linkType=\"replace\" icon=\"edit\" text=\"Redirect to ...\"/><GridItem url=\"/ui-demo/button\" icon=\"edit\" text=\"Navigate to ...\"/></Grid></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"column","type":"number","optional":true,"description":"每行列数"},{"name":"border","type":"boolean","optional":true,"description":"是否显示边框","defaultValue":"false","values":[false,true]},{"name":"gutter","type":"number","optional":true,"description":"栅格列间隔,单位 px","defaultValue":"0"},{"name":"square","type":"boolean","optional":true,"description":"是否使用正方形布局","defaultValue":"false","values":[false,true]},{"name":"clickable","type":"boolean","optional":true,"description":"是否显示可点击状态","defaultValue":"false","values":[false,true]},{"name":"bgColor","type":"string","optional":true,"description":"背景颜色"},{"name":"hoverClass","type":"string","optional":true,"description":"按压状态类名","defaultValue":"''"},{"name":"center","type":"boolean","optional":true,"description":"标题与内容是否垂直居中","defaultValue":"true","values":[false,true]},{"name":"direction","type":"'vertical'|'horizontal'","optional":true,"description":"布局或展开方向","defaultValue":"'vertical'","values":["vertical","horizontal"]},{"name":"reverse","type":"boolean","optional":true,"description":"是否反向显示","defaultValue":"false","values":[false,true]},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸","defaultValue":"32"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onNavigate","type":"GridNavigation","optional":true,"description":""}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","图标入口"],"title":"图标入口","section":"基础用法","description":"通过 `Grid.column` 设置每行列数,通过 `GridItem.icon` 和 `text` 设置每个入口。","language":"tsx","code":"<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n","blocks":[{"language":"tsx","code":"<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n"}]},{"name":"demo-2","aliases":["demo-2","四列宫格"],"title":"四列宫格","section":"布局能力","description":"设置 `column={4}` 每行展示四项,设置 `border` 显示边框。","language":"tsx","code":"<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n","blocks":[{"language":"tsx","code":"<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n"}]}],"allowUnknownProps":false},{"name":"GridItem","id":"grid","label":"Grid 宫格","category":"数据展示","categoryId":"display","kind":"component","description":"宫格用于展示一组并列入口,支持列数、边框、自定义内容和点击导航。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Grid.tsx","docPath":"docs/ui/components/grid.md","doc":"# Grid 宫格\n\n宫格用于展示一组并列入口,支持列数、边框、自定义内容和点击导航。\n\n```tsx\nimport { Grid, GridItem } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 图标入口\n\n通过 `Grid.column` 设置每行列数,通过 `GridItem.icon` 和 `text` 设置每个入口。\n\n```tsx\n<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n```\n\n## 布局能力\n\n### 四列宫格\n\n设置 `column={4}` 每行展示四项,设置 `border` 显示边框。\n\n```tsx\n<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n```\n\n## Attributes 属性\n\n### Grid\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| column | 每行列数 | `number` | — |\n| border | 是否显示边框 | `boolean` | `false` |\n| gutter | 栅格列间隔,单位 px | `number` | `0` |\n| square | 是否使用正方形布局 | `boolean` | `false` |\n| clickable | 是否显示可点击状态 | `boolean` | `false` |\n| bgColor | 背景颜色 | `string` | — |\n| hoverClass | 按压状态类名 | `string` | `''` |\n| center | 标题与内容是否垂直居中 | `boolean` | `true` |\n| direction | 布局或展开方向 | `'vertical'\\|'horizontal'` | `'vertical'` |\n| reverse | 是否反向显示 | `boolean` | `false` |\n| iconSize | 图标尺寸 | `number` | `32` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### GridItem\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `ReactNode` | — |\n| icon | 图标内容 | `string` | — |\n| iconColor | 图标颜色 | `string` | — |\n| iconSize | 图标尺寸 | `number` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| isDot | 是否显示圆点徽标 | `boolean` | — |\n| value | 当前值;传入后由调用方更新 | `string\\|number` | — |\n| max | 最大值或数量上限 | `number` | — |\n| type | 类型 | `BadgeProps['type']` | — |\n| badgeProps | 徽标属性配置 | `BadgeProps` | — |\n| ellipsis | 是否截断超出范围的文字 | `boolean` | `false` |\n| url | 跳转或媒体地址 | `string` | — |\n| linkType | 链接打开方式 | `'push'\\|'replace'` | `'push'` |\n| className | 根节点自定义类名 | `string` | `''` |\n| textClassName | 文字区域类名 | `string` | `''` |\n| iconClassName | 图标区域类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Grid.onNavigate | 对应操作发生时触发 | GridNavigation |\n| GridItem.onNavigate | 对应操作发生时触发 | GridNavigation |\n| GridItem.onItemClick | 对应操作发生时触发 | (event:TouchEvent)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Grid.children | 自定义内容 | ReactNode |\n| GridItem.text | 显示文字 | ReactNode |\n| GridItem.renderIcon | 自定义图标 | ReactNode |\n| GridItem.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type GridNavigation = (\n url: string,\n options: { replace: boolean },\n) => void;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Grid 组件源码](./sources/grid/Grid.tsx.txt) · [GridItem 组件源码](./sources/grid/Grid.tsx.txt) · [示例源码](./sources/grid/demo.tsx.txt) · [文档源码](./sources/grid/docs.md.txt)\n","demoSource":"import { Grid, GridItem } from 'daisu-ui';\nimport { useAppRouter } from '../../../app/router.js';\nimport cat from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst cells=(count:number)=>Array.from({length:count},(_,i)=><GridItem key={i} icon=\"image\" text=\"文字\"/>);\nconst horizontal=(reverse=false)=>['图标居'+(reverse?'右':'左'),'设置选项','卡券中心','订单列表'].map((text,i)=><GridItem key={i} icon={['image','settings','tag','list'][i]} text={text}/>);\nexport function GridExample(){\n const router=useAppRouter();\n return <view className=\"demo-grid-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><Grid clickable>{cells(4)}</Grid></ExampleBlock><ExampleBlock title=\"内容插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i}><image src={cat} className=\"demo-grid-image\" mode=\"scaleToFill\"/></GridItem>)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"自定义列数\" noPadding><Grid column={3}>{cells(6)}</Grid></ExampleBlock><ExampleBlock title=\"正方形格子\" noPadding><Grid square column={4} border gutter={10}>{cells(8)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义背景颜色\" noPadding><Grid bgColor=\"var(--cso-ui-canvas)\">{cells(4)}</Grid></ExampleBlock><ExampleBlock title=\"显示border\"><Grid column={3} border>{cells(6)}</Grid></ExampleBlock><ExampleBlock title=\"设定格间隙\" noPadding><Grid gutter={10} column={4}>{cells(8)}</Grid></ExampleBlock><ExampleBlock title=\"提示信息\" noPadding><Grid><GridItem isDot icon=\"gift\" text=\"文字\"/><GridItem value={100} max={99} icon=\"desktop\" text=\"文字\"/></Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\"><ExampleBlock title=\"横向布局\" noPadding><Grid direction=\"horizontal\" column={2}>{horizontal()}</Grid></ExampleBlock><ExampleBlock title=\"横向布局 + 图标调换\" noPadding><Grid direction=\"horizontal\" reverse column={2} border>{horizontal(true)}</Grid></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"图标插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i} text=\"文字\" renderIcon={<image src={cat} className=\"demo-grid-slot-image\"/>}/>)}</Grid></ExampleBlock><ExampleBlock title=\"文字插槽\" noPadding><Grid>{[0,1,2].map(i=><GridItem key={i} icon=\"image\" text={<text className=\"demo-grid-slot-text\">自定义文字插槽</text>} textClassName=\"demo-grid-custom-text\"/>)}</Grid></ExampleBlock><ExampleBlock title=\"自定义样式\" noPadding><Grid><GridItem ellipsis className=\"demo-grid-custom-item\" icon=\"search-line\" text=\"AI 友好的设计系统,提供 80+ 高质量组件,支持暗黑模式、国际化和自定义主题。\"/><GridItem ellipsis className=\"demo-grid-custom-item\" icon=\"settings\" text=\"基于Vue3+TS开发,提供80+高质量组件,支持暗黑模式、国际化和自定义主题。\"/></Grid></ExampleBlock><ExampleBlock title=\"页面导航\" noPadding><Grid clickable onNavigate={(_url,options)=>{ 'background only';void router.navigate({to:'/ui-demo/$page',params:{page:'button'},replace:options.replace});}}><GridItem url=\"/ui-demo/button\" linkType=\"replace\" icon=\"edit\" text=\"Redirect to ...\"/><GridItem url=\"/ui-demo/button\" icon=\"edit\" text=\"Navigate to ...\"/></Grid></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"text","type":"ReactNode","optional":true,"description":"显示文字"},{"name":"icon","type":"string","optional":true,"description":"图标内容"},{"name":"iconColor","type":"string","optional":true,"description":"图标颜色"},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸"},{"name":"isDot","type":"boolean","optional":true,"description":"是否显示圆点徽标","values":[false,true]},{"name":"value","type":"string|number","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"max","type":"number","optional":true,"description":"最大值或数量上限"},{"name":"type","type":"BadgeProps['type']","optional":true,"description":"类型","values":["primary","success","info","warning","danger"]},{"name":"badgeProps","type":"BadgeProps","optional":true,"description":"徽标属性配置"},{"name":"ellipsis","type":"boolean","optional":true,"description":"是否截断超出范围的文字","defaultValue":"false","values":[false,true]},{"name":"url","type":"string","optional":true,"description":"跳转或媒体地址"},{"name":"linkType","type":"'push'|'replace'","optional":true,"description":"链接打开方式","defaultValue":"'push'","values":["push","replace"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"textClassName","type":"string","optional":true,"description":"文字区域类名","defaultValue":"''"},{"name":"iconClassName","type":"string","optional":true,"description":"图标区域类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onNavigate","type":"GridNavigation","optional":true,"description":""},{"name":"onItemClick","type":"(event:TouchEvent)=>void","optional":true,"description":""}],"slots":[{"name":"text","type":"ReactNode","optional":true,"description":"显示文字"},{"name":"renderIcon","type":"ReactNode","optional":true,"description":""},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","图标入口"],"title":"图标入口","section":"基础用法","description":"通过 `Grid.column` 设置每行列数,通过 `GridItem.icon` 和 `text` 设置每个入口。","language":"tsx","code":"<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n","blocks":[{"language":"tsx","code":"<Grid column={3}>\n <GridItem icon=\"home\" text=\"首页\" />\n <GridItem icon=\"image\" text=\"相册\" />\n <GridItem icon=\"user\" text=\"我的\" />\n</Grid>\n"}]},{"name":"demo-2","aliases":["demo-2","四列宫格"],"title":"四列宫格","section":"布局能力","description":"设置 `column={4}` 每行展示四项,设置 `border` 显示边框。","language":"tsx","code":"<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n","blocks":[{"language":"tsx","code":"<Grid column={4} border>\n <GridItem text=\"入口一\" />\n <GridItem text=\"入口二\" />\n <GridItem text=\"入口三\" />\n <GridItem text=\"入口四\" />\n</Grid>\n"}]}],"allowUnknownProps":false},{"name":"Icon","id":"icon","label":"Icon 图标","category":"基础","categoryId":"basic","kind":"component","description":"图标用于表示操作、状态和导航。支持305个内置 SVG 图标名称、图片地址、自定义颜色与尺寸,内置图形基于 Tabler Icons 3.53.0(MIT)。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Icon.tsx","docPath":"docs/ui/components/icon.md","doc":"# Icon 图标\n\n图标用于表示操作、状态和导航。支持305个内置 SVG 图标名称、图片地址、自定义颜色与尺寸,内置图形基于 Tabler Icons 3.53.0(MIT)。\n\n```tsx\nimport { Icon } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 内置图标\n\n通过 `name` 指定内置图标名称。\n\n```tsx\n<Icon name=\"home\" />\n<Icon name=\"search-line\" />\n<Icon name=\"settings\" />\n```\n\n## 组件样式\n\n### 颜色与尺寸\n\n通过 `color` 设置图标颜色,`size` 设置图标尺寸,单位为 px。\n\n```tsx\n<Icon name=\"heart-fill\" size={32} color=\"#f14646\" />\n```\n\n## 交互用法\n\n### 点击图标\n\n通过 `onTap` 响应点击,为可操作图标设置 `accessibilityLabel` 说明用途。\n\n```tsx\n<Icon\n name=\"download\"\n accessibilityLabel=\"下载文件\"\n onTap={() => {\n 'background only';\n console.log('下载');\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| name | 名称或标识 | `IconName \\| (string & {})` | 必填 |\n| color | 内容颜色 | `string` | — |\n| size | 尺寸 | `number` | `16` |\n| className | 根节点自定义类名 | `string` | `''` |\n| accessibilityLabel | 读屏工具使用的操作说明 | `string` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onTap | 点击时触发 | () => void |\n\n## 数据类型\n\n```tsx\nexport type IconName = keyof typeof iconPaths;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n\n## 源代码\n\n[Icon 组件源码](./sources/icon/Icon.tsx.txt) · [示例源码](./sources/icon/demo.tsx.txt) · [文档源码](./sources/icon/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Icon, SyncedInput } from 'daisu-ui';\nimport { iconCategories } from './iconCatalog.js';\nimport { usePressState } from 'daisu-ui/utils';\nimport type { IconName } from 'daisu-ui';\n\nfunction IconTile({ name, onSelect }: { name: IconName; onSelect: (name: string) => void }) {\n const press = usePressState(true);\n return <view className={`demo-icon-item ${press.pressed ? 'demo-icon-item-pressed' : ''}`} accessibility-element accessibility-traits=\"button\" accessibility-label={name} bindtouchstart={press.start} bindtouchend={press.end} bindtouchcancel={press.end} bindmousedown={press.start} bindmouseup={press.end} bindmouseleave={press.end} bindtap={() => { 'background only'; onSelect(name); }}><view className=\"demo-icon-glyph\"><Icon name={name} size={24} /></view><text className=\"demo-icon-name\">{name}</text></view>;\n}\n\nexport function IconExample() {\n const [keyword, setKeyword] = useState('');\n const [selected, setSelected] = useState('');\n const categories = iconCategories.map(category => ({ ...category, names: category.names.filter(name => name.toLowerCase().includes(keyword.trim().toLowerCase())) })).filter(category => category.names.length);\n useEffect(() => {\n if (!selected) return;\n const timer = setTimeout(() => setSelected(''), 1500);\n return () => clearTimeout(timer);\n }, [selected]);\n return <view className=\"demo-icon-page\">\n <view className=\"demo-icon-search\"><view className=\"demo-icon-search-field\"><Icon name=\"search-line\" size={16} color=\"#4e5369\" /><SyncedInput className={`demo-icon-search-input ${keyword ? '' : 'demo-icon-search-input-empty'}`} value={keyword} placeholder=\"搜你所想\" onInput={setKeyword} />{keyword ? <Icon name=\"close-circle-fill\" size={16} accessibilityLabel=\"清空搜索\" onTap={() => { 'background only'; setKeyword(''); }} /> : null}</view></view>\n <scroll-view className=\"demo-icon-scroll\" scroll-y scroll-orientation=\"vertical\">\n {categories.map(category => <view key={category.title} className=\"demo-icon-category\"><text className=\"demo-icon-category-title\">{category.title}</text><view className=\"demo-icon-grid\">{category.names.map(name => <IconTile key={name} name={name} onSelect={setSelected} />)}</view></view>)}\n {!categories.length ? <view className=\"demo-icon-empty\"><Icon name=\"search-line\" size={64} /><text>当前无相关图标</text></view> : null}\n </scroll-view>\n {selected ? <view className=\"demo-icon-notice\" user-interaction-enabled={false}><text>{`<Icon name=\"${selected}\" size={24} />`}</text></view> : null}\n </view>;\n}\n","props":[{"name":"name","type":"IconName | (string & {})","optional":false,"description":"名称或标识","defaultValue":"必填"},{"name":"color","type":"string","optional":true,"description":"内容颜色"},{"name":"size","type":"number","optional":true,"description":"尺寸","defaultValue":"16"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"accessibilityLabel","type":"string","optional":true,"description":"读屏工具使用的操作说明"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""}],"demos":[{"name":"basic","aliases":["demo-1","内置图标"],"title":"内置图标","section":"组件类型","description":"通过 `name` 指定内置图标名称。","language":"tsx","code":"<Icon name=\"home\" />\n<Icon name=\"search-line\" />\n<Icon name=\"settings\" />\n","blocks":[{"language":"tsx","code":"<Icon name=\"home\" />\n<Icon name=\"search-line\" />\n<Icon name=\"settings\" />\n"}]},{"name":"demo-2","aliases":["demo-2","颜色与尺寸"],"title":"颜色与尺寸","section":"组件样式","description":"通过 `color` 设置图标颜色,`size` 设置图标尺寸,单位为 px。","language":"tsx","code":"<Icon name=\"heart-fill\" size={32} color=\"#f14646\" />\n","blocks":[{"language":"tsx","code":"<Icon name=\"heart-fill\" size={32} color=\"#f14646\" />\n"}]},{"name":"demo-3","aliases":["demo-3","点击图标"],"title":"点击图标","section":"交互用法","description":"通过 `onTap` 响应点击,为可操作图标设置 `accessibilityLabel` 说明用途。","language":"tsx","code":"<Icon\n name=\"download\"\n accessibilityLabel=\"下载文件\"\n onTap={() => {\n 'background only';\n console.log('下载');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Icon\n name=\"download\"\n accessibilityLabel=\"下载文件\"\n onTap={() => {\n 'background only';\n console.log('下载');\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"ImagePreview","id":"image-preview","label":"ImagePreview 图片预览","category":"数据展示","categoryId":"display","kind":"component","description":"图片预览用于全屏查看图片组,支持切换、缩放、长按事件与自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/ImagePreview.tsx","docPath":"docs/ui/components/image-preview.md","doc":"# ImagePreview 图片预览\n\n图片预览用于全屏查看图片组,支持切换、缩放、长按事件与自定义内容。\n\n```tsx\nimport { ImagePreview } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 打开预览\n\n将 `useImagePreview()` 返回的 `props` 绑定到 `ImagePreview`,调用 `previewImage()` 并传入 `images` 打开预览。\n\n```tsx\nimport { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n```\n\n## 内容形态\n\n### 多张图片\n\n通过 `images` 设置图片组,通过 `startPosition` 指定初始显示的图片索引。\n\n```tsx\nconst preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| images | 预览图片地址列表 | `readonly string[]` | — |\n| startPosition | 预览初始索引 | `number` | — |\n| showIndex | 是否显示当前索引 | `boolean` | — |\n| loop | 是否循环切换 | `boolean` | — |\n| closeable | 是否展示关闭入口 | `boolean` | — |\n| closeIcon | 关闭图标 | `string` | — |\n| closeIconPosition | 关闭图标位置 | `'top-left'\\|'top-right'` | — |\n| closeOnClick | 点击内容是否关闭 | `boolean` | — |\n| zIndex | 浮层层级 | `number` | — |\n| show | 是否显示 | `boolean` | — |\n| options | 选项配置 | `ImagePreviewOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| duration | 动画或显示时长,单位 ms | `number` | `300` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onOpen | 打开时触发 | ()=>void |\n| onClose | 关闭时触发 | ()=>void |\n| onChange | 值发生变化时触发 | (index:number)=>void |\n| onClick | 点击时触发 | (index:number)=>void |\n| onLongPress | 对应操作发生时触发 | (index:number)=>void |\n| onShowChange | 显示状态变化时触发 | (show:boolean)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderClose | 自定义区域内容 | (close:()=>void)=>ReactNode |\n| renderIndicator | 自定义区域内容 | (info:{current:number;total:number})=>ReactNode |\n| renderContent | 自定义内容 | (info:ImagePreviewSlot)=>ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | (input?:readonly string[]\\|ImagePreviewOptions)=>void |\n| close | 关闭面板 | ()=>void |\n| setActive | 调用实例方法 | (index:number)=>void |\n\n## 数据类型\n\n```tsx\nexport type ImagePreviewOptions = {\n images?: readonly string[];\n startPosition?: number;\n showIndex?: boolean;\n loop?: boolean;\n closeable?: boolean;\n closeIcon?: string;\n closeIconPosition?: 'top-left' | 'top-right';\n closeOnClick?: boolean;\n zIndex?: number;\n onOpen?: () => void;\n onClose?: () => void;\n onChange?: (index: number) => void;\n onClick?: (index: number) => void;\n onLongPress?: (index: number) => void;\n};\n\nexport type ImagePreviewSlot = {\n current: number;\n total: number;\n images: readonly string[];\n close: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-image-preview-bg` | 当前组件 |\n\n## 源代码\n\n[ImagePreview 组件源码](./sources/image-preview/ImagePreview.tsx.txt) · [示例源码](./sources/image-preview/demo.tsx.txt) · [文档源码](./sources/image-preview/docs.md.txt)\n","demoSource":"import { Button, ImagePreview, SwiperNav, useImagePreview } from 'daisu-ui';\nimport type { ImagePreviewOptions } from 'daisu-ui';\nimport redpanda from '../../../assets/demo-red-panda.jpg';\nimport capybara from '../../../assets/demo-capybara.jpg';\nimport panda from '../../../assets/demo-panda.jpg';\nimport moon from '../../../assets/demo-moon.jpg';\nimport meng from '../../../assets/demo-landscape.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst images=[redpanda,capybara,panda,moon,meng],labels=['小熊猫','水豚','大熊猫','月亮','萌宠'];\nexport function ImagePreviewExample(){\n const preview=useImagePreview(),custom=useImagePreview();\n const open=(input:ImagePreviewOptions={})=>{ 'background only';preview.previewImage({images,...input}); };\n return <view className=\"demo-image-preview-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Button label=\"预览图片\" onTap={()=>open()}/></ExampleBlock><ExampleBlock title=\"传入图片数组\"><Button label=\"直接传入数组\" onTap={()=>preview.previewImage(images)}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"指定起始位置\"><Button label=\"从第二张开始\" onTap={()=>open({startPosition:1})}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件配置\"><ExampleBlock title=\"隐藏页码\"><Button label=\"不显示页码\" onTap={()=>open({showIndex:false})}/></ExampleBlock><ExampleBlock title=\"隐藏关闭按钮\"><Button label=\"不显示关闭按钮\" onTap={()=>open({closeable:false})}/></ExampleBlock><ExampleBlock title=\"关闭按钮位置\"><Button label=\"左上角\" onTap={()=>open({closeIconPosition:'top-left'})}/><Button label=\"右上角\" onTap={()=>open({closeIconPosition:'top-right'})}/></ExampleBlock><ExampleBlock title=\"禁用点击关闭\"><Button label=\"点击不关闭\" onTap={()=>open({closeOnClick:false})}/></ExampleBlock><ExampleBlock title=\"禁用循环\"><Button label=\"禁用循环播放\" onTap={()=>open({loop:false})}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"监听事件\"><Button label=\"带事件回调\" onTap={()=>open({onOpen:()=>console.info('预览已打开'),onClose:()=>console.info('预览已关闭'),onChange:index=>console.info('当前图片索引:',index)})}/></ExampleBlock><ExampleBlock title=\"使用插槽\"><Button label=\"自定义插槽\" onTap={()=>custom.previewImage({images,showIndex:false})}/></ExampleBlock></DemoGroup>\n <ImagePreview {...preview.props} rootPortal/>\n <ImagePreview {...custom.props} rootPortal renderIndicator={({current,total})=><SwiperNav current={current} total={total} type=\"dots-bar\" style={{bottom:'64px'}}/>} renderContent={({current})=><text className=\"demo-image-preview-bottom\">{labels[current]}</text>}/>\n </view>;\n}\n","props":[{"name":"images","type":"readonly string[]","optional":true,"description":"预览图片地址列表"},{"name":"startPosition","type":"number","optional":true,"description":"预览初始索引"},{"name":"showIndex","type":"boolean","optional":true,"description":"是否显示当前索引","values":[false,true]},{"name":"loop","type":"boolean","optional":true,"description":"是否循环切换","values":[false,true]},{"name":"closeable","type":"boolean","optional":true,"description":"是否展示关闭入口","values":[false,true]},{"name":"closeIcon","type":"string","optional":true,"description":"关闭图标"},{"name":"closeIconPosition","type":"'top-left'|'top-right'","optional":true,"description":"关闭图标位置","values":["top-left","top-right"]},{"name":"closeOnClick","type":"boolean","optional":true,"description":"点击内容是否关闭","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"show","type":"boolean","optional":true,"description":"是否显示","values":[false,true]},{"name":"options","type":"ImagePreviewOptions","optional":true,"description":"选项配置"},{"name":"requestKey","type":"number","optional":true,"description":"重复请求标识,变化时重置当前展示","defaultValue":"0"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"300"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onOpen","type":"()=>void","optional":true,"description":"打开时触发"},{"name":"onClose","type":"()=>void","optional":true,"description":"关闭时触发"},{"name":"onChange","type":"(index:number)=>void","optional":true,"description":"值发生变化时触发"},{"name":"onClick","type":"(index:number)=>void","optional":true,"description":"点击时触发"},{"name":"onLongPress","type":"(index:number)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onShowChange","type":"(show:boolean)=>void","optional":true,"description":"显示状态变化时触发"}],"slots":[{"name":"renderClose","type":"(close:()=>void)=>ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderIndicator","type":"(info:{current:number;total:number})=>ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderContent","type":"(info:ImagePreviewSlot)=>ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"open","description":"打开面板","type":"(input?:readonly string[]|ImagePreviewOptions)=>void"},{"name":"close","description":"关闭面板","type":"()=>void"},{"name":"setActive","description":"调用实例方法","type":"(index:number)=>void"}],"cssVars":[{"name":"--cso-ui-image-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","打开预览"],"title":"打开预览","section":"基础用法","description":"将 `useImagePreview()` 返回的 `props` 绑定到 `ImagePreview`,调用 `previewImage()` 并传入 `images` 打开预览。","language":"tsx","code":"import { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n","blocks":[{"language":"tsx","code":"import { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","多张图片"],"title":"多张图片","section":"内容形态","description":"通过 `images` 设置图片组,通过 `startPosition` 指定初始显示的图片索引。","language":"tsx","code":"const preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n","blocks":[{"language":"tsx","code":"const preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n"}]}],"allowUnknownProps":false},{"name":"Img","id":"img","label":"Img 图片","category":"数据展示","categoryId":"display","kind":"component","description":"图片组件提供加载、失败、圆角和预览处理,支持不同填充方式与自定义占位内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Img.tsx","docPath":"docs/ui/components/img.md","doc":"# Img 图片\n\n图片组件提供加载、失败、圆角和预览处理,支持不同填充方式与自定义占位内容。\n\n```tsx\nimport { Img } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 显示图片\n\n通过 `src` 指定图片地址,通过 `width` 和 `height` 设置显示尺寸。\n\n```tsx\n<Img src=\"https://example.com/photo.jpg\" width={120} height={120} />\n```\n\n## 组件样式\n\n### 圆形图片\n\n设置 `round` 展示圆形图片,配合相同的宽高使用。\n\n```tsx\n<Img src=\"https://example.com/avatar.jpg\" width={80} height={80} round />\n```\n\n## 内容形态\n\n### 加载失败处理\n\n通过 `onError` 接收图片加载失败事件。\n\n```tsx\n<Img\n src=\"https://example.com/photo.jpg\"\n width={120}\n height={120}\n onError={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| src | 位图来源/预览替换来源;支持原生可读取URL、本地构建资源、位图data URL | `string` | — |\n| previewSrc | 位图来源/预览替换来源;支持原生可读取URL、本地构建资源、位图data URL | `string` | — |\n| width | number或CSS长度字符串,数字按px;传百分比时依赖父容器实际尺寸 | `number \\| string` | — |\n| height | number或CSS长度字符串,数字按px;传百分比时依赖父容器实际尺寸 | `number \\| string` | — |\n| mode | scaleToFill/aspectFit/aspectFill、widthFix/heightFix、center/top/bottom/left/right及四角 | `ImgMode` | — |\n| round | 圆形或圆角裁剪;radius支持数字与长度字符串 | `boolean` | — |\n| radius | 圆形或圆角裁剪;radius支持数字与长度字符串 | `number \\| string` | — |\n| showLoading | 是否展示对应占位 | `boolean` | — |\n| showError | 是否展示对应占位 | `boolean` | — |\n| loading | ReactNode插槽,默认32px image/image-failloading图标 | `ReactNode` | — |\n| error | ReactNode插槽,默认32px image/image-failloading图标 | `ReactNode` | — |\n| enablePreview | 仅成功加载且有src时触发预览 | `boolean` | — |\n| alt | 外层原生无障碍标签,并非传给image的HTML alt | `string` | — |\n| customImage | 内部image类名、根节点类名及样式 | `string` | — |\n| className | 内部image类名、根节点类名及样式 | `string` | — |\n| style | 内部image类名、根节点类名及样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onPreview | 显式预览适配器 `(url:string)=>void\\|Promise<void>`;同一实例防止并发重复调用 | ImgPreview |\n| onPreviewError | 适配器缺失或拒绝时的Error通知 | (error: Error) => void |\n| onClick | 任意加载状态下均可点击通知 | () => void |\n| onLoad | 原生完整事件,load.detail包含图片width/height | (event: BaseEvent<'load', ImageLoadEvent>) => void |\n| onError | 原生完整事件,load.detail包含图片width/height | (event: BaseEvent<'error', ImageErrorEvent>) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| loading | ReactNode插槽,默认32px image/image-failloading图标 | ReactNode |\n| error | ReactNode插槽,默认32px image/image-failloading图标 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ImgMode =\n | 'scaleToFill'\n | 'aspectFit'\n | 'aspectFill'\n | 'widthFix'\n | 'heightFix'\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top left'\n | 'top right'\n | 'bottom left'\n | 'bottom right';\n\nexport type ImgPreview = (url: string) => void | Promise<void>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-img-loading-bg` | 当前组件 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Img 组件源码](./sources/img/Img.tsx.txt) · [示例源码](./sources/img/demo.tsx.txt) · [文档源码](./sources/img/docs.md.txt)\n","demoSource":"import type { HostClient } from '../../../lib/host.js';\nimport { Img, Loading, Toast, useToast } from 'daisu-ui';\nimport type { ImgMode, ImgPreview } from 'daisu-ui';\nimport cat from '../../../assets/demo-cat.png';\nimport previewCat from '../../../assets/demo-cat-large.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst modes: ImgMode[] = ['top left','top right','bottom left','bottom right','right','left','center','bottom','top','heightFix','widthFix','scaleToFill','aspectFit','aspectFill'];\n// No source keeps the native placeholder visible; malformed bitmap data exercises real load failure.\nconst failed = 'data:image/png;base64,aW52YWxpZA==';\nexport function ImgExample({ host }: { host?: HostClient | null }) {\n const toast = useToast();\n const preview: ImgPreview = async url => {\n 'background only';\n if (!host || !await host.call('media.image.preview', { urls: [url], current: 0 })) throw new Error('宿主暂不支持图片预览');\n };\n return <view className=\"demo-img-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本使用\"><Img width={100} height={100} src={cat}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"加载中\"><view className=\"demo-img-grid demo-img-grid-two\">{[false,true].map(custom => <view key={String(custom)} className=\"demo-img-col\"><Img width=\"100%\" height=\"27vw\" loading={custom ? <Loading style={{ alignSelf: 'center' }}/> : undefined}/><text className=\"demo-img-label\">{custom ? '自定义提示' : '默认提示'}</text></view>)}</view></ExampleBlock>\n <ExampleBlock title=\"加载失败\"><view className=\"demo-img-grid demo-img-grid-two\">{[false,true].map(custom => <view key={String(custom)} className=\"demo-img-col\"><Img width=\"100%\" height=\"27vw\" src={failed} error={custom ? <view className=\"demo-img-custom-error\"><text>加载失败</text></view> : undefined}/><text className=\"demo-img-label\">{custom ? '自定义提示' : '默认提示'}</text></view>)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">{['填充','圆形','圆角'].map((title,index) => <ExampleBlock key={title} title={title}><view className=\"demo-img-grid\">{modes.map(mode => <view className=\"demo-img-col\" key={mode}><Img src={cat} width=\"100%\" height=\"27vw\" mode={mode} round={index === 1} radius={index === 2 ? 5 : undefined}/><text className=\"demo-img-label\">{mode}</text></view>)}</view></ExampleBlock>)}</DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"可预览\"><view className=\"demo-img-grid demo-img-grid-two\">{[false,true].map(custom => <view className=\"demo-img-col\" key={String(custom)}><Img width=\"100%\" mode=\"widthFix\" src={cat} previewSrc={custom ? previewCat : undefined} enablePreview onPreview={preview} onPreviewError={error => { 'background only'; toast.error(error.message); }}/><text className=\"demo-img-label\">{custom ? '指定预览图' : '默认预览图'}</text></view>)}</view></ExampleBlock></DemoGroup>\n <Toast {...toast.props}/>\n </view>;\n}\n","props":[{"name":"src","type":"string","optional":true,"description":"位图来源/预览替换来源;支持原生可读取URL、本地构建资源、位图data URL"},{"name":"previewSrc","type":"string","optional":true,"description":"位图来源/预览替换来源;支持原生可读取URL、本地构建资源、位图data URL"},{"name":"width","type":"number | string","optional":true,"description":"number或CSS长度字符串,数字按px;传百分比时依赖父容器实际尺寸"},{"name":"height","type":"number | string","optional":true,"description":"number或CSS长度字符串,数字按px;传百分比时依赖父容器实际尺寸"},{"name":"mode","type":"ImgMode","optional":true,"description":"scaleToFill/aspectFit/aspectFill、widthFix/heightFix、center/top/bottom/left/right及四角","values":["bottom","left","right","top","center","scaleToFill","aspectFit","aspectFill","widthFix","heightFix","top left","top right","bottom left","bottom right"]},{"name":"round","type":"boolean","optional":true,"description":"圆形或圆角裁剪;radius支持数字与长度字符串","values":[false,true]},{"name":"radius","type":"number | string","optional":true,"description":"圆形或圆角裁剪;radius支持数字与长度字符串"},{"name":"showLoading","type":"boolean","optional":true,"description":"是否展示对应占位","values":[false,true]},{"name":"showError","type":"boolean","optional":true,"description":"是否展示对应占位","values":[false,true]},{"name":"loading","type":"ReactNode","optional":true,"description":"ReactNode插槽,默认32px image/image-failloading图标"},{"name":"error","type":"ReactNode","optional":true,"description":"ReactNode插槽,默认32px image/image-failloading图标"},{"name":"enablePreview","type":"boolean","optional":true,"description":"仅成功加载且有src时触发预览","values":[false,true]},{"name":"alt","type":"string","optional":true,"description":"外层原生无障碍标签,并非传给image的HTML alt"},{"name":"customImage","type":"string","optional":true,"description":"内部image类名、根节点类名及样式"},{"name":"className","type":"string","optional":true,"description":"内部image类名、根节点类名及样式"},{"name":"style","type":"CSSProperties","optional":true,"description":"内部image类名、根节点类名及样式"}],"events":[{"name":"onPreview","type":"ImgPreview","optional":true,"description":"显式预览适配器 (url:string)=>void|Promise<void>;同一实例防止并发重复调用"},{"name":"onPreviewError","type":"(error: Error) => void","optional":true,"description":"适配器缺失或拒绝时的Error通知"},{"name":"onClick","type":"() => void","optional":true,"description":"任意加载状态下均可点击通知"},{"name":"onLoad","type":"(event: BaseEvent<'load', ImageLoadEvent>) => void","optional":true,"description":"原生完整事件,load.detail包含图片width/height"},{"name":"onError","type":"(event: BaseEvent<'error', ImageErrorEvent>) => void","optional":true,"description":"原生完整事件,load.detail包含图片width/height"}],"slots":[{"name":"loading","type":"ReactNode","optional":true,"description":"ReactNode插槽,默认32px image/image-failloading图标"},{"name":"error","type":"ReactNode","optional":true,"description":"ReactNode插槽,默认32px image/image-failloading图标"}],"methods":[],"cssVars":[{"name":"--cso-ui-img-loading-bg","defaultValue":"#f7f8fa","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","显示图片"],"title":"显示图片","section":"基础用法","description":"通过 `src` 指定图片地址,通过 `width` 和 `height` 设置显示尺寸。","language":"tsx","code":"<Img src=\"https://example.com/photo.jpg\" width={120} height={120} />\n","blocks":[{"language":"tsx","code":"<Img src=\"https://example.com/photo.jpg\" width={120} height={120} />\n"}]},{"name":"demo-2","aliases":["demo-2","圆形图片"],"title":"圆形图片","section":"组件样式","description":"设置 `round` 展示圆形图片,配合相同的宽高使用。","language":"tsx","code":"<Img src=\"https://example.com/avatar.jpg\" width={80} height={80} round />\n","blocks":[{"language":"tsx","code":"<Img src=\"https://example.com/avatar.jpg\" width={80} height={80} round />\n"}]},{"name":"demo-3","aliases":["demo-3","加载失败处理"],"title":"加载失败处理","section":"内容形态","description":"通过 `onError` 接收图片加载失败事件。","language":"tsx","code":"<Img\n src=\"https://example.com/photo.jpg\"\n width={120}\n height={120}\n onError={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Img\n src=\"https://example.com/photo.jpg\"\n width={120}\n height={120}\n onError={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"ImgCropper","id":"img-cropper","label":"ImgCropper 图片裁剪","category":"录入","categoryId":"form","kind":"component","description":"图片裁剪器用于选取图片区域、旋转和导出裁剪结果,浏览器模式通过 Web 宿主提供裁剪能力。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/ImgCropper.tsx","docPath":"docs/ui/components/img-cropper.md","doc":"# ImgCropper 图片裁剪\n\n图片裁剪器用于选取图片区域、旋转和导出裁剪结果,浏览器模式通过 Web 宿主提供裁剪能力。\n\n```tsx\nimport { ImgCropper } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 打开裁剪器\n\n设置 `mode=\"browser\"` 使用浏览器裁剪能力,通过 `show` 控制显示,`imgSrc` 指定图片,`onConfirm` 返回裁剪结果。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"裁剪图片\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ImgCropper\n show={show}\n onShowChange={setShow}\n mode=\"browser\"\n imgSrc=\"https://example.com/photo.jpg\"\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n```\n\n## 组件样式\n\n### 裁剪尺寸\n\n通过 `imgWidth` 和 `imgHeight` 指定图片初始显示尺寸;裁剪框比例由 `aspectRatio` 控制。\n\n```tsx\n<ImgCropper show={false} mode=\"browser\" imgWidth={280} imgHeight={280} />\n```\n\n## 平台与资源说明\n\n浏览器宿主须在挂载 lynx-view 前调用 daisu-ui/web 的 registerDaisuWebComponents,并设置 mode=\"browser\"。支持20MB以内 PNG/JPEG/WebP/GIF 本地选图、拖动、双指/滚轮缩放、旋转及锁边。aspectRatio 控制裁剪框,imgWidth/imgHeight 仅为图片初始尺寸。导出真实 PNG/JPEG;tempFilePath 为页面内 Blob URL,关闭时保留,revokeResult 或卸载时释放,刷新后失效。持久化时需保存实际位图内容;跨域图片需允许 CORS。实例方法返回 true 表示请求已发送,onConfirm 才代表编码成功,失败由 onError 返回。Flutter 后端待接入。\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| show | 打开与关闭;未传show时可通过ref.open/close控制 | `boolean` | — |\n| imgSrc | HTTP(S)、相对地址、同源Blob或8MiB以内PNG/JPEG/WebP/GIF Base64;SVG/file等不支持;跨域图片服务器须允许CORS读取,否则无法导出 | `string` | `''` |\n| imgWidth | 初始宽/高,正数px或百分比;始终保留原比例,并按裁剪框锁边,不拉伸图片 | `number\\|string` | — |\n| imgHeight | 初始宽/高,正数px或百分比;始终保留原比例,并按裁剪框锁边,不拉伸图片 | `number\\|string` | — |\n| aspectRatio | 正数width:height,比例0.02–50;示例含1:1、3:2、16:9、16:10 | `string` | `'1:1'` |\n| disabledRotate | 隐藏旋转按钮并阻止setRotate | `boolean` | `false` |\n| exportScale | 导出像素/裁剪框CSS像素,有限正数且不超过8;结果每边1–4096、总计不超过1600万像素,超限报错 | `number` | `2` |\n| maxScale | 相对当前角度最小覆盖比例的最大缩放,1–20 | `number` | `3` |\n| quality | 0–1,JPEG压缩质量;PNG由浏览器无损编码 | `number` | `1` |\n| fileType | png / jpg / jpeg;jpeg归一为jpg | `'png'\\|'jpg'\\|'jpeg'` | `'png'` |\n| cancelButtonText | 底部操作文案 | `string` | `'取消'` |\n| confirmButtonText | 底部操作文案 | `string` | `'完成'` |\n| autoChoose | 打开且imgSrc为空时尝试打开文件选择;浏览器限制时仍可点击编辑器中的「选择图片」 | `boolean` | `false` |\n| mode | browser启用已注册的浏览器编辑器;Flutter暂无裁剪后端 | `'browser'\\|'none'` | `'none'` |\n| rootPortal | 根部已有RootPortalHost时可启用 | `boolean` | `false` |\n| topInset | 顶部保留区域及公共Overlay层级;示例保留44px导航栏 | `number` | `0` |\n| zIndex | 顶部保留区域及公共Overlay层级;示例保留44px导航栏 | `number` | `1000` |\n| className | 编辑器外层样式 | `string` | `''` |\n| style | 编辑器外层样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onShowChange | 打开与关闭;未传show时可通过ref.open/close控制 | (show:boolean)=>void |\n| onConfirm | 确认选择时触发 | (result:ImgCropperResult)=>void |\n| onCancel | 取消操作时触发 | ()=>void |\n| onImgLoaded | 对应操作发生时触发 | (event:{res:{width:number;height:number}})=>void |\n| onImgLoadError | 对应操作发生时触发 | (event:{err:string})=>void |\n| onError | 发生错误时触发 | (error:{message:string;phase?:string})=>void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | (src?:string)=>boolean |\n| close | 关闭面板 | ()=>void |\n| chooseImage | 调用实例方法 | ()=>boolean |\n| confirm | 调用实例方法 | ()=>boolean |\n| setRotate | 调用实例方法 | (deg:number)=>boolean |\n| resetImg | 调用实例方法 | ()=>boolean |\n| revertIsAnimation | 调用实例方法 | (animation:boolean)=>boolean |\n| downloadResult | 调用实例方法 | (url:string)=>boolean |\n| revokeResult | 调用实例方法 | (url:string)=>void |\n\n## 数据类型\n\n```tsx\nexport type ImgCropperResult = {\n tempFilePath: string;\n width: number;\n height: number;\n fileType: 'png' | 'jpg';\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[ImgCropper 组件源码](./sources/img-cropper/ImgCropper.tsx.txt) · [示例源码](./sources/img-cropper/demo.tsx.txt) · [文档源码](./sources/img-cropper/docs.md.txt)\n","demoSource":"import { useInitData, useRef, useState } from '@lynx-js/react';\nimport { Button, Icon, Img, ImgCropper } from 'daisu-ui';\nimport type { ImgCropperRef, ImgCropperResult } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst ratios=['1:1','3:2','16:9','16:10','1:1'];\nexport function ImgCropperExample(){\n const init=useInitData() as unknown,browser=!!init&&typeof init==='object'&&'browserMedia' in init&&init.browserMedia===true;\n const [show,setShow]=useState(false),[current,setCurrent]=useState(0),[images,setImages]=useState<Record<number,ImgCropperResult>>({}),[error,setError]=useState('');\n const cropper=useRef<ImgCropperRef>(null),latest=useRef(images);latest.current=images;\n const open=(index:number)=>{'background only';if(!browser){setError('请在浏览器中使用图片裁剪。');return;}setCurrent(index);setError('');setShow(true);};\n const image=(index:number)=>{\n const height=index===1?200:index===2||index===3?168.75:200,result=images[index];\n return <view className={`demo-cropper-preview ${index===0||index===4?'demo-cropper-circular':'demo-cropper-rectangular'}`} style={{height:`${height}px`}} bindtap={()=>open(index)} accessibility-element accessibility-label=\"选择裁剪图片\" accessibility-traits=\"button\">\n {result?<Img src={result.tempFilePath} width=\"100%\" height=\"100%\" mode=\"aspectFit\"/>:<Icon name=\"camera-fill\" size={60} color=\"#fff\"/>}\n </view>;\n };\n return <view className=\"demo-cropper-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-cropper-profile\">{image(0)}<text className=\"demo-cropper-label\">点击上传头像</text></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件配置\"><ExampleBlock title=\"自定义裁剪比例\"><view className=\"demo-cropper-grid\">{[1,2,3].map(index=><view className=\"demo-cropper-grid-item\" key={index}>{image(index)}<text className=\"demo-cropper-label\">{ratios[index]}比例裁剪</text></view>)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"裁剪后导出\"><view className=\"demo-cropper-profile\">{image(4)}<text className=\"demo-cropper-label\">点击裁剪并导出 JPEG 头像</text></view>{images[4]?<view className=\"demo-cropper-result\"><text className=\"demo-cropper-label\">{images[4]!.width} × {images[4]!.height} · JPEG</text><Button label=\"下载裁剪图片\" size=\"small\" onTap={()=>{'background only';cropper.current?.downloadResult(images[4]!.tempFilePath);}}/></view>:null}</ExampleBlock></DemoGroup>\n {error?<text className=\"demo-rich-hint\">{error}</text>:null}\n <ImgCropper ref={cropper} show={show} onShowChange={setShow} mode={browser?'browser':'none'} autoChoose rootPortal topInset={44} style={{'--cso-ui-img-cropper-confirm-bg':'#1c64fd'} as never} aspectRatio={ratios[current]} fileType={current===4?'jpg':'png'} onConfirm={result=>{\n 'background only';const previous=latest.current[current];if(previous)cropper.current?.revokeResult(previous.tempFilePath);setImages(old=>({...old,[current]:result}));\n }} onError={({message})=>{'background only';setError(message);}}/>\n </view>;\n}\n","props":[{"name":"show","type":"boolean","optional":true,"description":"打开与关闭;未传show时可通过ref.open/close控制","values":[false,true]},{"name":"imgSrc","type":"string","optional":true,"description":"HTTP(S)、相对地址、同源Blob或8MiB以内PNG/JPEG/WebP/GIF Base64;SVG/file等不支持;跨域图片服务器须允许CORS读取,否则无法导出","defaultValue":"''"},{"name":"imgWidth","type":"number|string","optional":true,"description":"初始宽/高,正数px或百分比;始终保留原比例,并按裁剪框锁边,不拉伸图片"},{"name":"imgHeight","type":"number|string","optional":true,"description":"初始宽/高,正数px或百分比;始终保留原比例,并按裁剪框锁边,不拉伸图片"},{"name":"aspectRatio","type":"string","optional":true,"description":"正数width:height,比例0.02–50;示例含1:1、3:2、16:9、16:10","defaultValue":"'1:1'"},{"name":"disabledRotate","type":"boolean","optional":true,"description":"隐藏旋转按钮并阻止setRotate","defaultValue":"false","values":[false,true]},{"name":"exportScale","type":"number","optional":true,"description":"导出像素/裁剪框CSS像素,有限正数且不超过8;结果每边1–4096、总计不超过1600万像素,超限报错","defaultValue":"2"},{"name":"maxScale","type":"number","optional":true,"description":"相对当前角度最小覆盖比例的最大缩放,1–20","defaultValue":"3"},{"name":"quality","type":"number","optional":true,"description":"0–1,JPEG压缩质量;PNG由浏览器无损编码","defaultValue":"1"},{"name":"fileType","type":"'png'|'jpg'|'jpeg'","optional":true,"description":"png / jpg / jpeg;jpeg归一为jpg","defaultValue":"'png'","values":["png","jpg","jpeg"]},{"name":"cancelButtonText","type":"string","optional":true,"description":"底部操作文案","defaultValue":"'取消'"},{"name":"confirmButtonText","type":"string","optional":true,"description":"底部操作文案","defaultValue":"'完成'"},{"name":"autoChoose","type":"boolean","optional":true,"description":"打开且imgSrc为空时尝试打开文件选择;浏览器限制时仍可点击编辑器中的「选择图片」","defaultValue":"false","values":[false,true]},{"name":"mode","type":"'browser'|'none'","optional":true,"description":"browser启用已注册的浏览器编辑器;Flutter暂无裁剪后端","defaultValue":"'none'","values":["none","browser"]},{"name":"rootPortal","type":"boolean","optional":true,"description":"根部已有RootPortalHost时可启用","defaultValue":"false","values":[false,true]},{"name":"topInset","type":"number","optional":true,"description":"顶部保留区域及公共Overlay层级;示例保留44px导航栏","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"顶部保留区域及公共Overlay层级;示例保留44px导航栏","defaultValue":"1000"},{"name":"className","type":"string","optional":true,"description":"编辑器外层样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"编辑器外层样式"}],"events":[{"name":"onShowChange","type":"(show:boolean)=>void","optional":true,"description":"打开与关闭;未传show时可通过ref.open/close控制"},{"name":"onConfirm","type":"(result:ImgCropperResult)=>void","optional":true,"description":"确认选择时触发"},{"name":"onCancel","type":"()=>void","optional":true,"description":"取消操作时触发"},{"name":"onImgLoaded","type":"(event:{res:{width:number;height:number}})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onImgLoadError","type":"(event:{err:string})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onError","type":"(error:{message:string;phase?:string})=>void","optional":true,"description":"发生错误时触发"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"(src?:string)=>boolean"},{"name":"close","description":"关闭面板","type":"()=>void"},{"name":"chooseImage","description":"调用实例方法","type":"()=>boolean"},{"name":"confirm","description":"调用实例方法","type":"()=>boolean"},{"name":"setRotate","description":"调用实例方法","type":"(deg:number)=>boolean"},{"name":"resetImg","description":"调用实例方法","type":"()=>boolean"},{"name":"revertIsAnimation","description":"调用实例方法","type":"(animation:boolean)=>boolean"},{"name":"downloadResult","description":"调用实例方法","type":"(url:string)=>boolean"},{"name":"revokeResult","description":"调用实例方法","type":"(url:string)=>void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","打开裁剪器"],"title":"打开裁剪器","section":"基础用法","description":"设置 `mode=\"browser\"` 使用浏览器裁剪能力,通过 `show` 控制显示,`imgSrc` 指定图片,`onConfirm` 返回裁剪结果。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"裁剪图片\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ImgCropper\n show={show}\n onShowChange={setShow}\n mode=\"browser\"\n imgSrc=\"https://example.com/photo.jpg\"\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"裁剪图片\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<ImgCropper\n show={show}\n onShowChange={setShow}\n mode=\"browser\"\n imgSrc=\"https://example.com/photo.jpg\"\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","裁剪尺寸"],"title":"裁剪尺寸","section":"组件样式","description":"通过 `imgWidth` 和 `imgHeight` 指定图片初始显示尺寸;裁剪框比例由 `aspectRatio` 控制。","language":"tsx","code":"<ImgCropper show={false} mode=\"browser\" imgWidth={280} imgHeight={280} />\n","blocks":[{"language":"tsx","code":"<ImgCropper show={false} mode=\"browser\" imgWidth={280} imgHeight={280} />\n"}]}],"allowUnknownProps":false},{"name":"IndexAnchor","id":"index-bar","label":"IndexBar 索引栏","category":"导航","categoryId":"navigation","kind":"component","description":"索引栏适合按字母或分类组织长列表,支持索引点击、拖动定位和分组标题。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/IndexBar.tsx","docPath":"docs/ui/components/index-bar.md","doc":"# IndexBar 索引栏\n\n索引栏适合按字母或分类组织长列表,支持索引点击、拖动定位和分组标题。\n\n```tsx\nimport { IndexBar, IndexAnchor } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 字母分组列表\n\n通过 `sections` 配置索引和分组数据,`listId` 标识列表,`renderItem` 定义每行内容。\n\n```tsx\nimport { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n```\n\n## 组件样式\n\n### 自定义行高\n\n通过 `itemHeight` 设置列表行高,通过 `anchorHeight` 设置分组标题高度。\n\n```tsx\n<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n```\n\n## Attributes 属性\n\n### IndexBar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| listId | 当前 Lynx 页面内唯一的原生 List ID;保活的不同页面实例也须使用不同ID | `string` | 必填 |\n| sections | `{ index: string 或 number, data: readonly T[] }`,保留输入顺序,index须唯一 | `readonly IndexBarSection<T>[]` | 必填 |\n| getItemKey | 分组内稳定行标识;省略时用行序号,可能重排的数据应明确提供 | `(state: IndexBarRenderItem<T>) => string \\| number` | — |\n| sticky | 固定当前分组标题,下一分组到达时向上推离 | `boolean` | — |\n| itemHeight | 列表行高,px;自定义行内容须与此尺寸一致 | `number` | — |\n| anchorHeight | 分组标题高,px;自定义标题需改变高度时同步设置 | `number` | — |\n| className | 根节点样式,支持指定可测量的高度 | `string` | — |\n| style | 根节点样式,支持指定可测量的高度 | `CSSProperties` | — |\n\n泛型约束:`T`。\n\n### IndexAnchor\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| index | 序号列或分组索引 | `AnchorIndex` | 必填 |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点样式,支持指定可测量的高度 | `string` | `''` |\n| style | 根节点样式,支持指定可测量的高度 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| IndexBar.onChange | 点击、滑动定位或列表滚动导致激活索引变化时触发;挂载时不触发 | (event: { index: AnchorIndex }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| IndexBar.renderItem | 对应默认插槽的列表内容;通常返回公共 Cell | (state: IndexBarRenderItem<T>) => ReactNode |\n| IndexBar.renderAnchor | 对应 IndexAnchor 默认插槽,替换标题内容 | (state: { section: IndexBarSection<T>; sectionIndex: number }) => ReactNode |\n| IndexAnchor.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type IndexBarSection<T> = { index: AnchorIndex; data: readonly T[] };\n\nexport type IndexBarRenderItem<T> = {\n item: T;\n itemIndex: number;\n section: IndexBarSection<T>;\n sectionIndex: number;\n};\n\nexport type AnchorIndex = string | number;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[IndexBar 组件源码](./sources/index-bar/IndexBar.tsx.txt) · [IndexAnchor 组件源码](./sources/index-bar/IndexBar.tsx.txt) · [示例源码](./sources/index-bar/demo.tsx.txt) · [文档源码](./sources/index-bar/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Cell, IndexBar, RootPortal } from 'daisu-ui';\nimport { indexBarCities } from './indexBarData.js';\n\nexport function IndexBarExample() {\n const [message, setMessage] = useState('');\n useEffect(() => {\n if (!message) return;\n const timer = setTimeout(() => { 'background only'; setMessage(''); }, 2000);\n return () => clearTimeout(timer);\n }, [message]);\n return <view className=\"demo-index-bar-page\">\n <IndexBar listId=\"demo-index-bar-list\" sticky sections={indexBarCities} getItemKey={({ item }) => item} renderItem={({ item, section }) => <Cell title={item} border clickable onTap={() => { 'background only'; setMessage(`当前点击项:${section.index},城市:${item}`); }} />} />\n {message ? <RootPortal><view className=\"demo-index-bar-message\"><text>{message}</text></view></RootPortal> : null}\n </view>;\n}\n","props":[{"name":"index","type":"AnchorIndex","optional":false,"description":"序号列或分组索引","defaultValue":"必填"},{"name":"className","type":"string","optional":true,"description":"根节点样式,支持指定可测量的高度","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式,支持指定可测量的高度"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","字母分组列表"],"title":"字母分组列表","section":"组件类型","description":"通过 `sections` 配置索引和分组数据,`listId` 标识列表,`renderItem` 定义每行内容。","language":"tsx","code":"import { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n","blocks":[{"language":"tsx","code":"import { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义行高"],"title":"自定义行高","section":"组件样式","description":"通过 `itemHeight` 设置列表行高,通过 `anchorHeight` 设置分组标题高度。","language":"tsx","code":"<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n","blocks":[{"language":"tsx","code":"<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"IndexBar","id":"index-bar","label":"IndexBar 索引栏","category":"导航","categoryId":"navigation","kind":"component","description":"索引栏适合按字母或分类组织长列表,支持索引点击、拖动定位和分组标题。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/IndexBar.tsx","docPath":"docs/ui/components/index-bar.md","doc":"# IndexBar 索引栏\n\n索引栏适合按字母或分类组织长列表,支持索引点击、拖动定位和分组标题。\n\n```tsx\nimport { IndexBar, IndexAnchor } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 字母分组列表\n\n通过 `sections` 配置索引和分组数据,`listId` 标识列表,`renderItem` 定义每行内容。\n\n```tsx\nimport { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n```\n\n## 组件样式\n\n### 自定义行高\n\n通过 `itemHeight` 设置列表行高,通过 `anchorHeight` 设置分组标题高度。\n\n```tsx\n<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n```\n\n## Attributes 属性\n\n### IndexBar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| listId | 当前 Lynx 页面内唯一的原生 List ID;保活的不同页面实例也须使用不同ID | `string` | 必填 |\n| sections | `{ index: string 或 number, data: readonly T[] }`,保留输入顺序,index须唯一 | `readonly IndexBarSection<T>[]` | 必填 |\n| getItemKey | 分组内稳定行标识;省略时用行序号,可能重排的数据应明确提供 | `(state: IndexBarRenderItem<T>) => string \\| number` | — |\n| sticky | 固定当前分组标题,下一分组到达时向上推离 | `boolean` | — |\n| itemHeight | 列表行高,px;自定义行内容须与此尺寸一致 | `number` | — |\n| anchorHeight | 分组标题高,px;自定义标题需改变高度时同步设置 | `number` | — |\n| className | 根节点样式,支持指定可测量的高度 | `string` | — |\n| style | 根节点样式,支持指定可测量的高度 | `CSSProperties` | — |\n\n泛型约束:`T`。\n\n### IndexAnchor\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| index | 序号列或分组索引 | `AnchorIndex` | 必填 |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点样式,支持指定可测量的高度 | `string` | `''` |\n| style | 根节点样式,支持指定可测量的高度 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| IndexBar.onChange | 点击、滑动定位或列表滚动导致激活索引变化时触发;挂载时不触发 | (event: { index: AnchorIndex }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| IndexBar.renderItem | 对应默认插槽的列表内容;通常返回公共 Cell | (state: IndexBarRenderItem<T>) => ReactNode |\n| IndexBar.renderAnchor | 对应 IndexAnchor 默认插槽,替换标题内容 | (state: { section: IndexBarSection<T>; sectionIndex: number }) => ReactNode |\n| IndexAnchor.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type IndexBarSection<T> = { index: AnchorIndex; data: readonly T[] };\n\nexport type IndexBarRenderItem<T> = {\n item: T;\n itemIndex: number;\n section: IndexBarSection<T>;\n sectionIndex: number;\n};\n\nexport type AnchorIndex = string | number;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[IndexBar 组件源码](./sources/index-bar/IndexBar.tsx.txt) · [IndexAnchor 组件源码](./sources/index-bar/IndexBar.tsx.txt) · [示例源码](./sources/index-bar/demo.tsx.txt) · [文档源码](./sources/index-bar/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Cell, IndexBar, RootPortal } from 'daisu-ui';\nimport { indexBarCities } from './indexBarData.js';\n\nexport function IndexBarExample() {\n const [message, setMessage] = useState('');\n useEffect(() => {\n if (!message) return;\n const timer = setTimeout(() => { 'background only'; setMessage(''); }, 2000);\n return () => clearTimeout(timer);\n }, [message]);\n return <view className=\"demo-index-bar-page\">\n <IndexBar listId=\"demo-index-bar-list\" sticky sections={indexBarCities} getItemKey={({ item }) => item} renderItem={({ item, section }) => <Cell title={item} border clickable onTap={() => { 'background only'; setMessage(`当前点击项:${section.index},城市:${item}`); }} />} />\n {message ? <RootPortal><view className=\"demo-index-bar-message\"><text>{message}</text></view></RootPortal> : null}\n </view>;\n}\n","props":[{"name":"listId","type":"string","optional":false,"description":"当前 Lynx 页面内唯一的原生 List ID;保活的不同页面实例也须使用不同ID","defaultValue":"必填"},{"name":"sections","type":"readonly IndexBarSection<T>[]","optional":false,"description":"{ index: string 或 number, data: readonly T[] },保留输入顺序,index须唯一","defaultValue":"必填"},{"name":"getItemKey","type":"(state: IndexBarRenderItem<T>) => string | number","optional":true,"description":"分组内稳定行标识;省略时用行序号,可能重排的数据应明确提供"},{"name":"sticky","type":"boolean","optional":true,"description":"固定当前分组标题,下一分组到达时向上推离","values":[false,true]},{"name":"itemHeight","type":"number","optional":true,"description":"列表行高,px;自定义行内容须与此尺寸一致"},{"name":"anchorHeight","type":"number","optional":true,"description":"分组标题高,px;自定义标题需改变高度时同步设置"},{"name":"className","type":"string","optional":true,"description":"根节点样式,支持指定可测量的高度","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式,支持指定可测量的高度"}],"events":[{"name":"onChange","type":"(event: { index: AnchorIndex }) => void","optional":true,"description":""}],"slots":[{"name":"renderItem","type":"(state: IndexBarRenderItem<T>) => ReactNode","optional":false,"description":""},{"name":"renderAnchor","type":"(state: { section: IndexBarSection<T>; sectionIndex: number }) => ReactNode","optional":true,"description":""}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","字母分组列表"],"title":"字母分组列表","section":"组件类型","description":"通过 `sections` 配置索引和分组数据,`listId` 标识列表,`renderItem` 定义每行内容。","language":"tsx","code":"import { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n","blocks":[{"language":"tsx","code":"import { Cell } from 'daisu-ui';\n\n<IndexBar\n listId=\"contact-list\"\n sections={[\n { index: 'A', data: ['阿明', '安然'] },\n { index: 'B', data: ['白云'] },\n ]}\n renderItem={({ item }) => <Cell title={item} />}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义行高"],"title":"自定义行高","section":"组件样式","description":"通过 `itemHeight` 设置列表行高,通过 `anchorHeight` 设置分组标题高度。","language":"tsx","code":"<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n","blocks":[{"language":"tsx","code":"<IndexBar\n listId=\"city-list\"\n itemHeight={48}\n anchorHeight={32}\n sections={[{ index: 'A', data: ['安庆'] }]}\n renderItem={({ item }) => <text>{item}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Input","id":"input","label":"Input 输入框","category":"录入","categoryId":"form","kind":"component","description":"输入框用于录入单行文本,支持受控值、清空、密码、字数统计和前后插槽。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Input.tsx","docPath":"docs/ui/components/input.md","doc":"# Input 输入框\n\n输入框用于录入单行文本,支持受控值、清空、密码、字数统计和前后插槽。\n\n```tsx\nimport { Input } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基本使用\n\n通过 `placeholder` 设置占位文字。\n\n```tsx\n<Input placeholder=\"请输入歪比巴卜\" />\n```\n\n### 数字类型\n\n设置 `type=\"number\"` 使用数字输入类型。\n\n```tsx\n<Input type=\"number\" placeholder=\"请输入数字\" />\n```\n\n## 组件状态\n\n### 禁用状态\n\n设置 `disabled` 禁用输入框,禁用时不能编辑或清空内容。\n\n```tsx\n<Input defaultValue=\"这是禁用状态\" disabled />\n```\n\n### 只读状态\n\n设置 `readonly` 使内容只读。\n\n```tsx\n<Input defaultValue=\"这是只读状态\" readonly />\n```\n\n### 错误状态\n\n设置 `error` 展示错误状态,内容使用错误颜色。\n\n```tsx\n<Input defaultValue=\"123456\" error />\n```\n\n## 组件变体\n\n### 清空按钮\n\n设置 `clearable`,输入框有内容时显示清空按钮。\n\n```tsx\n<Input defaultValue=\"支持清空\" clearable />\n```\n\n### 有值且聚焦时展示清空按钮\n\n设置 `clearTrigger=\"focus\"`,仅在有值并且聚焦时显示清空按钮。\n\n```tsx\n<Input clearable clearTrigger=\"focus\" />\n```\n\n### 点击清除按钮时不自动聚焦\n\n设置 `focusWhenClear={false}`,点击清空按钮后不自动聚焦。\n\n```tsx\n<Input clearable focusWhenClear={false} />\n```\n\n### 密码框\n\n设置 `showPassword` 显示密码切换按钮,可组合 `clearable` 使用。\n\n```tsx\n<Input defaultValue=\"password\" showPassword clearable />\n```\n\n## 内容形态\n\n### 设置前后 Icon\n\n通过 `prefixIcon` 和 `suffixIcon` 设置前后图标,点击分别触发 `onClickPrefixIcon` 和 `onClickSuffixIcon`。\n\n```tsx\n<Input prefixIcon=\"sound\" suffixIcon=\"send\" />\n```\n\n### 后缀插槽\n\n通过 `suffix` 自定义后缀内容,例如放置验证码按钮。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Input\n placeholder=\"请输入验证码\"\n suffix={<Button label=\"获取验证码\" size=\"small\" />}\n/>\n```\n\n## 组件样式\n\n### 字数限制\n\n设置 `maxlength` 限制输入长度,配合 `showWordLimit` 显示字数统计。\n\n```tsx\n<Input defaultValue=\"1234\" maxlength={20} showWordLimit />\n```\n\n### 紧凑布局\n\n设置 `compact` 使用紧凑布局,可与单位文字等内容组合。\n\n```tsx\n<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <Input compact placeholder=\"请输入价格\" style={{ width: '155px' }} />\n <text>元</text>\n</view>\n```\n\n## 特殊用法\n\n### 结合表单使用\n\n在 `Cell` 中组合输入框,使用 `center` 垂直居中、`required` 展示必填标记,输入框设置 `compact`。\n\n```tsx\nimport { CellGroup, Cell } from 'daisu-ui';\n\n<CellGroup border>\n <Cell center title=\"基本用法\" titleWidth=\"98px\">\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"必填\" titleWidth=\"98px\" required>\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"自定义插槽\" titleWidth=\"98px\">\n <Input compact suffix={<Button label=\"获取验证码\" size=\"small\" />} />\n </Cell>\n</CellGroup>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `string \\| number` | — |\n| defaultValue | 非受控模式的初始值 | `string \\| number` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| maxlength | 最大输入长度,-1 表示不限制 | `number` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| readonly | 是否只读 | `boolean` | — |\n| clearable | 是否显示清空入口 | `boolean` | — |\n| clearTrigger | 清空入口显示条件 | `'always' \\| 'focus'` | — |\n| focusWhenClear | 清空后是否自动聚焦 | `boolean` | — |\n| error | 是否展示错误状态 | `boolean` | — |\n| compact | 紧凑布局 | `boolean` | — |\n| alignRight | 是否右对齐 | `boolean` | — |\n| prefixIcon | 前置图标名称 | `string` | — |\n| suffixIcon | 后置图标名称 | `string` | — |\n| prefix | 前置内容 | `ReactNode` | — |\n| suffix | 后置内容 | `ReactNode` | — |\n| showWordLimit | 是否显示字数统计 | `boolean` | — |\n| focus | 是否获取输入焦点 | `boolean` | — |\n| confirmType | 键盘确认按钮类型 | `'done' \\| 'go' \\| 'next' \\| 'search' \\| 'send'` | — |\n| confirmHold | 确认后是否保持键盘 | `boolean` | — |\n| avoidKeyboard | 是否避让键盘 | `boolean` | — |\n| cursorSpacing | 光标与键盘之间的距离 | `number` | — |\n| softInputMode | 软键盘避让模式 | `'unspecified' \\| 'nothing' \\| 'pan' \\| 'resize'` | — |\n| holdKeyboard | 是否保持键盘显示 | `boolean` | — |\n| selectionStart | 文本选择开始位置 | `number` | — |\n| selectionEnd | 文本选择结束位置 | `number` | — |\n| placeholderColor | 占位文字颜色 | `string` | — |\n| inputFilter | 原生输入过滤表达式 | `string` | — |\n| showSoftInputOnFocus | 聚焦时是否打开系统键盘 | `boolean` | — |\n| ignoreCompositionEvent | 是否在输入法合成结束后统一更新值 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| inputClassName | 输入区域类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| type | 类型 | `'text' \\| 'number' \\| 'digit' \\| 'password' \\| 'tel' \\| 'email'` | — |\n| showPassword | 是否显示密码切换入口 | `boolean` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (value: string) => void |\n| onInput | 原生输入事件 | (event: TextFieldEvent) => void |\n| onFocus | 获得焦点时触发 | (event: TextFieldEvent) => void |\n| onBlur | 失去焦点时触发 | (event: TextFieldEvent) => void |\n| onConfirm | 确认选择时触发 | (event: TextFieldEvent) => void |\n| onClear | 清空内容时触发 | () => void |\n| onClickPrefixIcon | 对应操作发生时触发 | () => void |\n| onClickSuffixIcon | 对应操作发生时触发 | () => void |\n| onTap | 点击时触发 | () => void |\n| onKeyboardHeightChange | 对应操作发生时触发 | (event: { height: number }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 前置内容 | ReactNode |\n| suffix | 后置内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| focus | 获得焦点 | () => void |\n| blur | 失去焦点 | () => void |\n| setSelectionRange | 调用实例方法 | (start: number, end: number) => void |\n\n## 数据类型\n\n```tsx\nexport type TextFieldEvent = {\n value: string;\n selectionStart?: number;\n selectionEnd?: number;\n isComposing?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Input 组件源码](./sources/input/Input.tsx.txt) · [示例源码](./sources/input/demo.tsx.txt) · [文档源码](./sources/input/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, Icon, Input, Toast, useToast } from 'daisu-ui';\nimport type { InputProps } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nfunction Sample({ defaultValue = '', ...props }: InputProps) { const [value, setValue] = useState<string | number>(defaultValue); return <Input {...props} value={value} onChange={setValue} />; }\nexport function InputExample() {\n const toast = useToast();\n return <view className=\"demo-input-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本使用\" noPadding><Sample placeholder=\"请输入歪比巴卜\" /></ExampleBlock><ExampleBlock title=\"数字类型\" noPadding><Sample type=\"number\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用状态\" noPadding><Sample defaultValue=\"这是禁用状态\" disabled /></ExampleBlock><ExampleBlock title=\"只读状态\" noPadding><Sample defaultValue=\"这是只读状态\" readonly /></ExampleBlock><ExampleBlock title=\"错误状态\" noPadding><Sample defaultValue=\"123456\" error /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"清空按钮\" noPadding><Sample defaultValue=\"支持清空\" clearable /></ExampleBlock><ExampleBlock title=\"有值且聚焦时展示清空按钮\" noPadding><Sample clearable clearTrigger=\"focus\" /></ExampleBlock><ExampleBlock title=\"点击清除按钮时不自动聚焦\" noPadding><Sample clearable focusWhenClear={false} /></ExampleBlock><ExampleBlock title=\"密码框\" noPadding><Sample clearable showPassword defaultValue=\"password\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"设置前后Icon\" noPadding><Sample prefixIcon=\"sound\" suffixIcon=\"send\" onClickPrefixIcon={() => { 'background only'; toast.show('点击前置图标'); }} onClickSuffixIcon={() => { 'background only'; toast.show('点击后置图标'); }} /></ExampleBlock><ExampleBlock title=\"后缀插槽\" noPadding><Sample placeholder=\"请输入歪比巴卜\" suffix={<Button label=\"获取验证码\" size=\"small\" onTap={() => { 'background only'; toast.show('点击获取验证码'); }} />} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"字数限制\" noPadding><Sample defaultValue=\"1234\" maxlength={20} showWordLimit /></ExampleBlock><ExampleBlock title=\"紧凑布局\"><view className=\"demo-input-compact\"><Sample compact placeholder=\"请输入价格\" style={{ width: '155px' }} /><text>元</text></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"结合表单使用\" noPadding><CellGroup border>\n <Cell center title=\"基本用法\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" /></Cell>\n <Cell center title=\"禁用\" titleWidth=\"98px\"><Sample compact disabled defaultValue=\"该输入框禁用\" /></Cell>\n <Cell center title=\"清除/密码\" titleWidth=\"98px\"><Sample compact showPassword clearable defaultValue=\"12345678\" /></Cell>\n <Cell center title=\"错误状态\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入歪比巴卜\" error /></Cell>\n <Cell center title=\"必填\" titleWidth=\"98px\" required><Sample compact placeholder=\"请输入歪比巴卜\" /></Cell>\n <Cell center title=\"字数限制\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" maxlength={20} showWordLimit /></Cell>\n <Cell center icon={<Icon name=\"sound\" size={18} />} title=\"图标\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" suffixIcon=\"send\" /></Cell>\n <Cell center title=\"自定义插槽\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" suffix={<Button size=\"small\" label=\"获取验证码\" onTap={() => { 'background only'; toast.show('点击获取验证码'); }} />} /></Cell>\n </CellGroup></ExampleBlock></DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"value","type":"string | number","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"string | number","optional":true,"description":"非受控模式的初始值"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示"},{"name":"maxlength","type":"number","optional":true,"description":"最大输入长度,-1 表示不限制"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"readonly","type":"boolean","optional":true,"description":"是否只读","values":[false,true]},{"name":"clearable","type":"boolean","optional":true,"description":"是否显示清空入口","values":[false,true]},{"name":"clearTrigger","type":"'always' | 'focus'","optional":true,"description":"清空入口显示条件","values":["always","focus"]},{"name":"focusWhenClear","type":"boolean","optional":true,"description":"清空后是否自动聚焦","values":[false,true]},{"name":"error","type":"boolean","optional":true,"description":"是否展示错误状态","values":[false,true]},{"name":"compact","type":"boolean","optional":true,"description":"紧凑布局","values":[false,true]},{"name":"alignRight","type":"boolean","optional":true,"description":"是否右对齐","values":[false,true]},{"name":"prefixIcon","type":"string","optional":true,"description":"前置图标名称"},{"name":"suffixIcon","type":"string","optional":true,"description":"后置图标名称"},{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后置内容"},{"name":"showWordLimit","type":"boolean","optional":true,"description":"是否显示字数统计","values":[false,true]},{"name":"focus","type":"boolean","optional":true,"description":"是否获取输入焦点","values":[false,true]},{"name":"confirmType","type":"'done' | 'go' | 'next' | 'search' | 'send'","optional":true,"description":"键盘确认按钮类型","values":["send","done","go","next","search"]},{"name":"confirmHold","type":"boolean","optional":true,"description":"确认后是否保持键盘","values":[false,true]},{"name":"avoidKeyboard","type":"boolean","optional":true,"description":"是否避让键盘","values":[false,true]},{"name":"cursorSpacing","type":"number","optional":true,"description":"光标与键盘之间的距离"},{"name":"softInputMode","type":"'unspecified' | 'nothing' | 'pan' | 'resize'","optional":true,"description":"软键盘避让模式","values":["resize","unspecified","nothing","pan"]},{"name":"holdKeyboard","type":"boolean","optional":true,"description":"是否保持键盘显示","values":[false,true]},{"name":"selectionStart","type":"number","optional":true,"description":"文本选择开始位置"},{"name":"selectionEnd","type":"number","optional":true,"description":"文本选择结束位置"},{"name":"placeholderColor","type":"string","optional":true,"description":"占位文字颜色"},{"name":"inputFilter","type":"string","optional":true,"description":"原生输入过滤表达式"},{"name":"showSoftInputOnFocus","type":"boolean","optional":true,"description":"聚焦时是否打开系统键盘","values":[false,true]},{"name":"ignoreCompositionEvent","type":"boolean","optional":true,"description":"是否在输入法合成结束后统一更新值","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"inputClassName","type":"string","optional":true,"description":"输入区域类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"type","type":"'text' | 'number' | 'digit' | 'password' | 'tel' | 'email'","optional":true,"description":"类型","values":["number","text","email","digit","password","tel"]},{"name":"showPassword","type":"boolean","optional":true,"description":"是否显示密码切换入口","values":[false,true]}],"events":[{"name":"onChange","type":"(value: string) => void","optional":true,"description":"值发生变化时触发"},{"name":"onInput","type":"(event: TextFieldEvent) => void","optional":true,"description":"原生输入事件"},{"name":"onFocus","type":"(event: TextFieldEvent) => void","optional":true,"description":"获得焦点时触发"},{"name":"onBlur","type":"(event: TextFieldEvent) => void","optional":true,"description":"失去焦点时触发"},{"name":"onConfirm","type":"(event: TextFieldEvent) => void","optional":true,"description":"确认选择时触发"},{"name":"onClear","type":"() => void","optional":true,"description":"清空内容时触发"},{"name":"onClickPrefixIcon","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onClickSuffixIcon","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"},{"name":"onKeyboardHeightChange","type":"(event: { height: number }) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后置内容"}],"methods":[{"name":"focus","description":"获得焦点","type":"() => void"},{"name":"blur","description":"失去焦点","type":"() => void"},{"name":"setSelectionRange","description":"调用实例方法","type":"(start: number, end: number) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","基本使用"],"title":"基本使用","section":"组件类型","description":"通过 `placeholder` 设置占位文字。","language":"tsx","code":"<Input placeholder=\"请输入歪比巴卜\" />\n","blocks":[{"language":"tsx","code":"<Input placeholder=\"请输入歪比巴卜\" />\n"}]},{"name":"demo-2","aliases":["demo-2","数字类型"],"title":"数字类型","section":"组件类型","description":"设置 `type=\"number\"` 使用数字输入类型。","language":"tsx","code":"<Input type=\"number\" placeholder=\"请输入数字\" />\n","blocks":[{"language":"tsx","code":"<Input type=\"number\" placeholder=\"请输入数字\" />\n"}]},{"name":"demo-3","aliases":["demo-3","禁用状态"],"title":"禁用状态","section":"组件状态","description":"设置 `disabled` 禁用输入框,禁用时不能编辑或清空内容。","language":"tsx","code":"<Input defaultValue=\"这是禁用状态\" disabled />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"这是禁用状态\" disabled />\n"}]},{"name":"demo-4","aliases":["demo-4","只读状态"],"title":"只读状态","section":"组件状态","description":"设置 `readonly` 使内容只读。","language":"tsx","code":"<Input defaultValue=\"这是只读状态\" readonly />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"这是只读状态\" readonly />\n"}]},{"name":"demo-5","aliases":["demo-5","错误状态"],"title":"错误状态","section":"组件状态","description":"设置 `error` 展示错误状态,内容使用错误颜色。","language":"tsx","code":"<Input defaultValue=\"123456\" error />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"123456\" error />\n"}]},{"name":"demo-6","aliases":["demo-6","清空按钮"],"title":"清空按钮","section":"组件变体","description":"设置 `clearable`,输入框有内容时显示清空按钮。","language":"tsx","code":"<Input defaultValue=\"支持清空\" clearable />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"支持清空\" clearable />\n"}]},{"name":"demo-7","aliases":["demo-7","有值且聚焦时展示清空按钮"],"title":"有值且聚焦时展示清空按钮","section":"组件变体","description":"设置 `clearTrigger=\"focus\"`,仅在有值并且聚焦时显示清空按钮。","language":"tsx","code":"<Input clearable clearTrigger=\"focus\" />\n","blocks":[{"language":"tsx","code":"<Input clearable clearTrigger=\"focus\" />\n"}]},{"name":"demo-8","aliases":["demo-8","点击清除按钮时不自动聚焦"],"title":"点击清除按钮时不自动聚焦","section":"组件变体","description":"设置 `focusWhenClear={false}`,点击清空按钮后不自动聚焦。","language":"tsx","code":"<Input clearable focusWhenClear={false} />\n","blocks":[{"language":"tsx","code":"<Input clearable focusWhenClear={false} />\n"}]},{"name":"demo-9","aliases":["demo-9","密码框"],"title":"密码框","section":"组件变体","description":"设置 `showPassword` 显示密码切换按钮,可组合 `clearable` 使用。","language":"tsx","code":"<Input defaultValue=\"password\" showPassword clearable />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"password\" showPassword clearable />\n"}]},{"name":"demo-10","aliases":["demo-10","设置前后 Icon"],"title":"设置前后 Icon","section":"内容形态","description":"通过 `prefixIcon` 和 `suffixIcon` 设置前后图标,点击分别触发 `onClickPrefixIcon` 和 `onClickSuffixIcon`。","language":"tsx","code":"<Input prefixIcon=\"sound\" suffixIcon=\"send\" />\n","blocks":[{"language":"tsx","code":"<Input prefixIcon=\"sound\" suffixIcon=\"send\" />\n"}]},{"name":"demo-11","aliases":["demo-11","后缀插槽"],"title":"后缀插槽","section":"内容形态","description":"通过 `suffix` 自定义后缀内容,例如放置验证码按钮。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Input\n placeholder=\"请输入验证码\"\n suffix={<Button label=\"获取验证码\" size=\"small\" />}\n/>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Input\n placeholder=\"请输入验证码\"\n suffix={<Button label=\"获取验证码\" size=\"small\" />}\n/>\n"}]},{"name":"demo-12","aliases":["demo-12","字数限制"],"title":"字数限制","section":"组件样式","description":"设置 `maxlength` 限制输入长度,配合 `showWordLimit` 显示字数统计。","language":"tsx","code":"<Input defaultValue=\"1234\" maxlength={20} showWordLimit />\n","blocks":[{"language":"tsx","code":"<Input defaultValue=\"1234\" maxlength={20} showWordLimit />\n"}]},{"name":"demo-13","aliases":["demo-13","紧凑布局"],"title":"紧凑布局","section":"组件样式","description":"设置 `compact` 使用紧凑布局,可与单位文字等内容组合。","language":"tsx","code":"<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <Input compact placeholder=\"请输入价格\" style={{ width: '155px' }} />\n <text>元</text>\n</view>\n","blocks":[{"language":"tsx","code":"<view\n style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\n>\n <Input compact placeholder=\"请输入价格\" style={{ width: '155px' }} />\n <text>元</text>\n</view>\n"}]},{"name":"demo-14","aliases":["demo-14","结合表单使用"],"title":"结合表单使用","section":"特殊用法","description":"在 `Cell` 中组合输入框,使用 `center` 垂直居中、`required` 展示必填标记,输入框设置 `compact`。","language":"tsx","code":"import { CellGroup, Cell } from 'daisu-ui';\n\n<CellGroup border>\n <Cell center title=\"基本用法\" titleWidth=\"98px\">\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"必填\" titleWidth=\"98px\" required>\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"自定义插槽\" titleWidth=\"98px\">\n <Input compact suffix={<Button label=\"获取验证码\" size=\"small\" />} />\n </Cell>\n</CellGroup>\n","blocks":[{"language":"tsx","code":"import { CellGroup, Cell } from 'daisu-ui';\n\n<CellGroup border>\n <Cell center title=\"基本用法\" titleWidth=\"98px\">\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"必填\" titleWidth=\"98px\" required>\n <Input compact placeholder=\"请输入\" />\n </Cell>\n <Cell center title=\"自定义插槽\" titleWidth=\"98px\">\n <Input compact suffix={<Button label=\"获取验证码\" size=\"small\" />} />\n </Cell>\n</CellGroup>\n"}]}],"allowUnknownProps":false},{"name":"InputNumber","id":"input-number","label":"InputNumber 计数器","category":"录入","categoryId":"form","kind":"component","description":"计数器用于在指定范围内调整数值,支持精度、步长、空值和异步变更校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/InputNumber.tsx","docPath":"docs/ui/components/input-number.md","doc":"# InputNumber 计数器\n\n计数器用于在指定范围内调整数值,支持精度、步长、空值和异步变更校验。\n\n```tsx\nimport { InputNumber } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础计数器\n\n通过 `value` 和 `onChange` 管理数值,使用 `min` 和 `max` 限定范围。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport type { InputNumberValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<InputNumberValue>(1);\n\n<InputNumber\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n min={1}\n max={10}\n/>\n```\n\n## 组件样式\n\n### 步长与精度\n\n通过 `step` 设置每次增减的数值,通过 `precision` 设置小数位数。\n\n```tsx\n<InputNumber defaultValue={1.5} step={0.1} precision={1} min={0} />\n```\n\n## 组件状态\n\n### 禁用与禁止输入\n\n设置 `disabled` 禁用整个计数器,设置 `disableInput` 仅禁止手动输入。\n\n```tsx\n<InputNumber disabled />\n<InputNumber disableInput defaultValue={3} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| min | 最小值 | `number` | `1` |\n| max | 最大值或数量上限 | `number` | — |\n| step | 每次增加或减少的步长 | `number` | `1` |\n| precision | 小数精度 | `number \\| string` | `0` |\n| stepStrictly | 是否严格按步长变化 | `boolean` | `false` |\n| allowNull | 是否允许空值 | `boolean` | `false` |\n| value | 当前值;传入后由调用方更新 | `InputNumberValue` | — |\n| defaultValue | 非受控模式的初始值 | `InputNumberValue` | `1` |\n| disabled | 是否禁用 | `boolean` | — |\n| disableInput | 是否禁止手动输入 | `boolean` | `false` |\n| disableMinus | 是否禁用减号 | `boolean` | `false` |\n| disablePlus | 是否禁用加号 | `boolean` | `false` |\n| withoutInput | 是否隐藏中间输入区域 | `boolean` | `false` |\n| inputWidth | 输入区域宽度 | `number \\| string` | `36` |\n| placeholder | 占位内容或输入提示 | `string` | `''` |\n| avoidKeyboard | 是否避让键盘 | `boolean` | `true` |\n| beforeChange | 变化前校验;返回 false 或拒绝 Promise 可阻止变化 | `(value: InputNumberValue) => boolean \\| Promise<boolean>` | — |\n| longPress | 是否支持长按连续调整 | `boolean` | `false` |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | `true` |\n| updateOnInit | 初始化时是否触发数值更新 | `boolean` | `true` |\n| inputType | 原生输入类型 | `'number' \\| 'digit'` | `'digit'` |\n| theme | 外观主题 | `InputNumberTheme` | `'default'` |\n| round | 圆角样式 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: InputNumberValue }) => void |\n| onFocus | 获得焦点时触发 | (event: TextFieldEvent) => void |\n| onBlur | 失去焦点时触发 | (event: TextFieldEvent) => void |\n\n## 数据类型\n\n```tsx\nexport type InputNumberValue = number | string;\n\nexport type InputNumberTheme =\n | 'default'\n | 'primary'\n | 'outline-split'\n | 'outline';\n\nexport type TextFieldEvent = {\n value: string;\n selectionStart?: number;\n selectionEnd?: number;\n isComposing?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-line-strong` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[InputNumber 组件源码](./sources/input-number/InputNumber.tsx.txt) · [示例源码](./sources/input-number/demo.tsx.txt) · [文档源码](./sources/input-number/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { InputNumber, Toast, useToast } from 'daisu-ui';\nimport type { InputNumberProps, InputNumberValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst themes = ['default', 'primary', 'outline-split', 'outline'] as const;\nfunction Sample({ defaultValue = 1, ...props }: InputNumberProps) {\n const [value, setValue] = useState<InputNumberValue>(defaultValue);\n return <InputNumber {...props} value={value} onChange={event => { 'background only'; setValue(event.value); }} />;\n}\nexport function InputNumberExample() {\n const [bounds, setBounds] = useState<InputNumberValue>(4), [quantity, setQuantity] = useState<InputNumberValue>(1), [temporary, setTemporary] = useState<InputNumberValue>(1);\n const [immediate, setImmediate] = useState<InputNumberValue>(1), [deferred, setDeferred] = useState<InputNumberValue>(1);\n const [corrected, setCorrected] = useState<InputNumberValue>(1), [unchanged, setUnchanged] = useState<InputNumberValue>(1);\n const toast = useToast(), timers = useRef(new Map<ReturnType<typeof setTimeout>, (allowed: boolean) => void>());\n useEffect(() => () => { for (const [timer, resolve] of timers.current) { clearTimeout(timer); resolve(false); } timers.current.clear(); }, []);\n const beforeChange = (next: InputNumberValue) => {\n 'background only'; toast.loading({ msg: `正在更新到${next}...` });\n return new Promise<boolean>(resolve => { const timer = setTimeout(() => { timers.current.delete(timer); toast.close(); resolve(true); }, 500); timers.current.set(timer, resolve); });\n };\n return <view className=\"demo-input-number-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本使用\"><view className=\"demo-input-number-grid\">{themes.map(theme => <Sample key={theme} theme={theme} />)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"禁用\"><view className=\"demo-input-number-grid\">{themes.map(theme => <Sample key={theme} theme={theme} disabled defaultValue={2} />)}</view></ExampleBlock>\n <ExampleBlock title=\"禁用输入框\"><Sample disableInput /></ExampleBlock>\n <ExampleBlock title=\"禁用减号按钮\"><view className=\"demo-input-number-grid\"><Sample disableMinus /><Sample disableMinus theme=\"primary\" /></view></ExampleBlock>\n <ExampleBlock title=\"禁用加号按钮\"><view className=\"demo-input-number-grid\"><Sample disablePlus /><Sample disablePlus theme=\"primary\" /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"圆角样式\"><view className=\"demo-input-number-grid\">{themes.map(theme => <Sample key={theme} theme={theme} round />)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"设置步长\"><Sample step={2} /></ExampleBlock>\n <ExampleBlock title=\"限制最大最小值\"><Sample min={3} max={10} /></ExampleBlock>\n <ExampleBlock title=\"设置小数精度\"><Sample defaultValue=\"1.2\" precision={1} step={0.1} /></ExampleBlock>\n <ExampleBlock title=\"输入严格为步数的倍数\"><Sample stepStrictly step={2} /></ExampleBlock>\n <ExampleBlock title=\"严格步进+边界限制\"><text className=\"demo-input-number-label\">值:{bounds}(步进值 2,最小值 3,最大值 15)</text><InputNumber value={bounds} onChange={event => { 'background only'; setBounds(event.value); }} stepStrictly step={2} min={3} max={15} /><view className=\"demo-input-number-tip demo-input-number-bounds-tip\"><text>输入 1 → 4(≥3 的最小 2 的倍数)</text><text>输入 5 → 6(最接近的 2 的倍数)</text><text>输入 17 → 14(≤15 的最大 2 的倍数)</text></view></ExampleBlock>\n <ExampleBlock title=\"修改输入框宽度\"><Sample defaultValue={2} inputWidth=\"70px\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊用法\">\n <ExampleBlock title=\"无输入框\"><view className=\"demo-input-number-row\"><text>数量:{quantity}</text><InputNumber withoutInput value={quantity} onChange={event => { 'background only'; setQuantity(event.value); }} /></view></ExampleBlock>\n <ExampleBlock title=\"允许空值,并设置 placeholder\"><Sample defaultValue=\"\" allowNull placeholder=\"不限\" inputWidth=\"70px\" /></ExampleBlock>\n <ExampleBlock title=\"非允许空值但可临时删除\"><text className=\"demo-input-number-label\">值:{temporary}(失焦时会自动修正为最小值)</text><InputNumber value={temporary} onChange={event => { 'background only'; setTemporary(event.value); }} /><text className=\"demo-input-number-tip demo-input-number-empty-tip\">尝试删除输入框中的所有内容,然后点击其他地方失焦</text></ExampleBlock>\n <ExampleBlock title=\"键盘弹起不上推页面\"><Sample avoidKeyboard={false} /></ExampleBlock>\n <ExampleBlock title=\"非立即更新模式\"><text className=\"demo-input-number-label\">立即更新模式(默认)- 值:{immediate}</text><InputNumber value={immediate} onChange={event => { 'background only'; setImmediate(event.value); }} /><text className=\"demo-input-number-label demo-input-number-label-next\">非立即更新模式 - 值:{deferred}</text><InputNumber immediateChange={false} value={deferred} onChange={event => { 'background only'; setDeferred(event.value); }} /></ExampleBlock>\n <ExampleBlock title=\"初始化时自动修正\"><text className=\"demo-input-number-label\">自动修正初始值 - 值:{corrected}</text><InputNumber min={3} max={15} step={2} stepStrictly value={corrected} onChange={event => { 'background only'; setCorrected(event.value); }} /><text className=\"demo-input-number-label demo-input-number-label-next\">不修正初始值 - 值:{unchanged}</text><InputNumber updateOnInit={false} min={3} max={15} step={2} stepStrictly value={unchanged} onChange={event => { 'background only'; setUnchanged(event.value); }} /><text className=\"demo-input-number-tip demo-input-number-init-tip\">上方组件会在初始化时自动将值 1 修正为 4(≥3 的最小 2 的倍数)</text></ExampleBlock>\n <ExampleBlock title=\"异步变更\"><Sample beforeChange={beforeChange} /></ExampleBlock>\n <ExampleBlock title=\"长按加减\"><Sample longPress /></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"min","type":"number","optional":true,"description":"最小值","defaultValue":"1"},{"name":"max","type":"number","optional":true,"description":"最大值或数量上限","defaultValue":"Number.MAX_SAFE_INTEGER"},{"name":"step","type":"number","optional":true,"description":"每次增加或减少的步长","defaultValue":"1"},{"name":"precision","type":"number | string","optional":true,"description":"小数精度","defaultValue":"0"},{"name":"stepStrictly","type":"boolean","optional":true,"description":"是否严格按步长变化","defaultValue":"false","values":[false,true]},{"name":"allowNull","type":"boolean","optional":true,"description":"是否允许空值","defaultValue":"false","values":[false,true]},{"name":"value","type":"InputNumberValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"InputNumberValue","optional":true,"description":"非受控模式的初始值","defaultValue":"1"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"disableInput","type":"boolean","optional":true,"description":"是否禁止手动输入","defaultValue":"false","values":[false,true]},{"name":"disableMinus","type":"boolean","optional":true,"description":"是否禁用减号","defaultValue":"false","values":[false,true]},{"name":"disablePlus","type":"boolean","optional":true,"description":"是否禁用加号","defaultValue":"false","values":[false,true]},{"name":"withoutInput","type":"boolean","optional":true,"description":"是否隐藏中间输入区域","defaultValue":"false","values":[false,true]},{"name":"inputWidth","type":"number | string","optional":true,"description":"输入区域宽度","defaultValue":"36"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示","defaultValue":"''"},{"name":"avoidKeyboard","type":"boolean","optional":true,"description":"是否避让键盘","defaultValue":"true","values":[false,true]},{"name":"beforeChange","type":"(value: InputNumberValue) => boolean | Promise<boolean>","optional":true,"description":"变化前校验;返回 false 或拒绝 Promise 可阻止变化"},{"name":"longPress","type":"boolean","optional":true,"description":"是否支持长按连续调整","defaultValue":"false","values":[false,true]},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","defaultValue":"true","values":[false,true]},{"name":"updateOnInit","type":"boolean","optional":true,"description":"初始化时是否触发数值更新","defaultValue":"true","values":[false,true]},{"name":"inputType","type":"'number' | 'digit'","optional":true,"description":"原生输入类型","defaultValue":"'digit'","values":["number","digit"]},{"name":"theme","type":"InputNumberTheme","optional":true,"description":"外观主题","defaultValue":"'default'","values":["primary","default","outline","outline-split"]},{"name":"round","type":"boolean","optional":true,"description":"圆角样式","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: InputNumberValue }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onFocus","type":"(event: TextFieldEvent) => void","optional":true,"description":"获得焦点时触发"},{"name":"onBlur","type":"(event: TextFieldEvent) => void","optional":true,"description":"失去焦点时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-line-strong","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","基础计数器"],"title":"基础计数器","section":"组件类型","description":"通过 `value` 和 `onChange` 管理数值,使用 `min` 和 `max` 限定范围。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { InputNumberValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<InputNumberValue>(1);\n\n<InputNumber\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n min={1}\n max={10}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { InputNumberValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<InputNumberValue>(1);\n\n<InputNumber\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n min={1}\n max={10}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","步长与精度"],"title":"步长与精度","section":"组件样式","description":"通过 `step` 设置每次增减的数值,通过 `precision` 设置小数位数。","language":"tsx","code":"<InputNumber defaultValue={1.5} step={0.1} precision={1} min={0} />\n","blocks":[{"language":"tsx","code":"<InputNumber defaultValue={1.5} step={0.1} precision={1} min={0} />\n"}]},{"name":"demo-3","aliases":["demo-3","禁用与禁止输入"],"title":"禁用与禁止输入","section":"组件状态","description":"设置 `disabled` 禁用整个计数器,设置 `disableInput` 仅禁止手动输入。","language":"tsx","code":"<InputNumber disabled />\n<InputNumber disableInput defaultValue={3} />\n","blocks":[{"language":"tsx","code":"<InputNumber disabled />\n<InputNumber disableInput defaultValue={3} />\n"}]}],"allowUnknownProps":false},{"name":"Keyboard","id":"keyboard","label":"Keyboard 虚拟键盘","category":"录入","categoryId":"form","kind":"component","description":"虚拟键盘为数字、身份证和车牌等输入场景提供统一按键面板,输入结果由 value 管理。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Keyboard.tsx","docPath":"docs/ui/components/keyboard.md","doc":"# Keyboard 虚拟键盘\n\n虚拟键盘为数字、身份证和车牌等输入场景提供统一按键面板,输入结果由 value 管理。\n\n```tsx\nimport { Keyboard } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 数字键盘\n\n通过 `visible` 和 `onVisibleChange` 控制键盘显示,通过 `value` 和 `onChange` 管理输入内容。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"打开键盘\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n```\n\n## 组件样式\n\n### 确认按钮\n\n通过 `title` 设置键盘顶部提示,使用 `visible` 控制显示状态。\n\n```tsx\n<Keyboard visible={false} title=\"请输入金额\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| visible | 受控显示,收起和点外部通知 false | `boolean` | `false` |\n| value | 受控或非受控输入值 | `string` | — |\n| defaultValue | 受控或非受控输入值 | `string` | `''` |\n| mode | default 数字、custom 右侧栏、car 车牌 | `KeyboardMode` | `'default'` |\n| title | 字符串或 ReactNode 自定义标题 | `ReactNode` | — |\n| extraKey | 默认布局一个额外键;custom 最多两个(如 ['00', '.']) | `string \\| readonly string[]` | — |\n| maxlength | 字符数上限;多字符额外键按剩余容量截断 | `number` | — |\n| showDeleteKey | 数字布局显示删除键、自定义删除文字;车牌布局始终有删除键 | `boolean` | `true` |\n| deleteText | 数字布局显示删除键、自定义删除文字;车牌布局始终有删除键 | `string` | `''` |\n| closeText | 默认布局头部关闭按钮,custom 右侧完成键;loading 禁止完成 | `string` | `''` |\n| closeButtonLoading | 默认布局头部关闭按钮,custom 右侧完成键;loading 禁止完成 | `boolean` | `false` |\n| randomKeyOrder | 每次打开或切换此配置时重新打乱 1–9,0 固定 | `boolean` | `false` |\n| carLang | zh 省份 / en 数字字母,受控语言由调用方更新 | `CarKeyboardLang` | — |\n| autoSwitchLang | 仅未传 carLang 时,首字符切英文、删空恢复省份 | `boolean` | `false` |\n| modal | 是否显示深色遮罩;false 时外部点击区透明 | `boolean` | `false` |\n| hideOnClickOutside | 是否提供点外部收起区域;false 时无 Overlay | `boolean` | `true` |\n| lockScroll | 复用 Popup 的原生手势拦截,不锁定 Flutter 外部滚动 | `boolean` | `true` |\n| safeAreaInsetBottom | 显式传入宿主安全区 px;不猜测设备底部高度 | `boolean` | `true` |\n| safeAreaBottom | 显式传入宿主安全区 px;不猜测设备底部高度 | `number` | `0` |\n| zIndex | 弹层层级及可选根节点挂载 | `number` | `100` |\n| rootPortal | 弹层层级及可选根节点挂载 | `boolean` | `false` |\n| disabled | 禁止输入;未显式指定时继承 FormItem 禁用 | `boolean` | — |\n| className | 键盘内容容器样式 | `string` | `''` |\n| style | 键盘内容容器样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onVisibleChange | 受控显示,收起和点外部通知 false | (visible: boolean) => void |\n| onChange | 值发生变化时触发 | (value: string) => void |\n| onCarLangChange | zh 省份 / en 数字字母,受控语言由调用方更新 | (lang: CarKeyboardLang) => void |\n| onInput | 原生输入事件 | (key: string) => void |\n| onDelete | 对应操作发生时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | 字符串或 ReactNode 自定义标题 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type KeyboardMode = 'default' | 'custom' | 'car';\n\nexport type CarKeyboardLang = 'zh' | 'en';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-on-primary` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-primary-pressed` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Keyboard 组件源码](./sources/keyboard/Keyboard.tsx.txt) · [示例源码](./sources/keyboard/demo.tsx.txt) · [文档源码](./sources/keyboard/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, Keyboard, Toast, useToast } from 'daisu-ui';\nimport type { CarKeyboardLang } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function KeyboardExample() {\n const [active, setActive] = useState('');\n const [values, setValues] = useState<Record<string, string>>({});\n const [lang, setLang] = useState<CarKeyboardLang>('zh');\n const toast = useToast();\n const row = (id: string, title: string, arrow = true, bound = false) => <Cell key={id} title={title} arrow={arrow} clickable value={bound ? values[id] ?? '' : undefined} onTap={() => { 'background only'; setActive(id); }} />;\n const car = active === 'car' || active === 'controlled-car';\n return <view className=\"demo-keyboard-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"键盘类型\" noPadding><CellGroup border>\n {row('default', '默认键盘')}{row('custom', '带右侧栏的键盘')}{row('id', '身份证键盘')}{row('car', '车牌号键盘(非受控)', true, true)}{row('controlled-car', '车牌号键盘(受控)', true, true)}\n </CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"标题与额外按键\" noPadding><CellGroup border>\n {row('title', '带标题的键盘')}{row('slot', 'slot自定义标题')}{row('extras', '多个额外按键')}{row('random', '随机数字键盘')}\n </CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"绑定与弹层\" noPadding><CellGroup border>\n {row('binding', '双向绑定', false, true)}{row('modal', '展示蒙层', false)}\n </CellGroup></ExampleBlock></DemoGroup>\n <Keyboard visible={!!active} onVisibleChange={visible => { 'background only'; if (!visible) setActive(''); }}\n value={values[active] ?? ''} onChange={value => { 'background only'; setValues(previous => ({ ...previous, [active]: value })); }}\n mode={car ? 'car' : active === 'custom' || active === 'extras' ? 'custom' : 'default'}\n extraKey={active === 'id' ? 'X' : active === 'extras' ? ['00', '.'] : ['custom', 'title', 'slot', 'binding'].includes(active) ? '.' : undefined}\n title={active === 'title' ? '输入密码' : active === 'slot' ? <text className=\"demo-keyboard-custom-title\">自定义标题</text> : active === 'binding' ? '键盘标题' : undefined}\n closeText={['custom', 'id', 'title', 'slot', 'extras', 'binding'].includes(active) ? '完成' : ''}\n maxlength={active === 'binding' ? 6 : Infinity} randomKeyOrder={active === 'random'} modal={active === 'modal'}\n autoSwitchLang={active === 'car'} carLang={active === 'controlled-car' ? lang : undefined} onCarLangChange={next => { 'background only'; if (active === 'controlled-car') setLang(next); }}\n onInput={key => toast.show(key)} onDelete={() => toast.show('删除')} />\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"visible","type":"boolean","optional":true,"description":"受控显示,收起和点外部通知 false","defaultValue":"false","values":[false,true]},{"name":"value","type":"string","optional":true,"description":"受控或非受控输入值"},{"name":"defaultValue","type":"string","optional":true,"description":"受控或非受控输入值","defaultValue":"''"},{"name":"mode","type":"KeyboardMode","optional":true,"description":"default 数字、custom 右侧栏、car 车牌","defaultValue":"'default'","values":["default","custom","car"]},{"name":"title","type":"ReactNode","optional":true,"description":"字符串或 ReactNode 自定义标题"},{"name":"extraKey","type":"string | readonly string[]","optional":true,"description":"默认布局一个额外键;custom 最多两个(如 ['00', '.'])"},{"name":"maxlength","type":"number","optional":true,"description":"字符数上限;多字符额外键按剩余容量截断","defaultValue":"Infinity"},{"name":"showDeleteKey","type":"boolean","optional":true,"description":"数字布局显示删除键、自定义删除文字;车牌布局始终有删除键","defaultValue":"true","values":[false,true]},{"name":"deleteText","type":"string","optional":true,"description":"数字布局显示删除键、自定义删除文字;车牌布局始终有删除键","defaultValue":"''"},{"name":"closeText","type":"string","optional":true,"description":"默认布局头部关闭按钮,custom 右侧完成键;loading 禁止完成","defaultValue":"''"},{"name":"closeButtonLoading","type":"boolean","optional":true,"description":"默认布局头部关闭按钮,custom 右侧完成键;loading 禁止完成","defaultValue":"false","values":[false,true]},{"name":"randomKeyOrder","type":"boolean","optional":true,"description":"每次打开或切换此配置时重新打乱 1–9,0 固定","defaultValue":"false","values":[false,true]},{"name":"carLang","type":"CarKeyboardLang","optional":true,"description":"zh 省份 / en 数字字母,受控语言由调用方更新","values":["zh","en"]},{"name":"autoSwitchLang","type":"boolean","optional":true,"description":"仅未传 carLang 时,首字符切英文、删空恢复省份","defaultValue":"false","values":[false,true]},{"name":"modal","type":"boolean","optional":true,"description":"是否显示深色遮罩;false 时外部点击区透明","defaultValue":"false","values":[false,true]},{"name":"hideOnClickOutside","type":"boolean","optional":true,"description":"是否提供点外部收起区域;false 时无 Overlay","defaultValue":"true","values":[false,true]},{"name":"lockScroll","type":"boolean","optional":true,"description":"复用 Popup 的原生手势拦截,不锁定 Flutter 外部滚动","defaultValue":"true","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"显式传入宿主安全区 px;不猜测设备底部高度","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"显式传入宿主安全区 px;不猜测设备底部高度","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"弹层层级及可选根节点挂载","defaultValue":"100"},{"name":"rootPortal","type":"boolean","optional":true,"description":"弹层层级及可选根节点挂载","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"禁止输入;未显式指定时继承 FormItem 禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"键盘内容容器样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"键盘内容容器样式"}],"events":[{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"受控显示,收起和点外部通知 false"},{"name":"onChange","type":"(value: string) => void","optional":true,"description":"值发生变化时触发"},{"name":"onCarLangChange","type":"(lang: CarKeyboardLang) => void","optional":true,"description":"zh 省份 / en 数字字母,受控语言由调用方更新"},{"name":"onInput","type":"(key: string) => void","optional":true,"description":"原生输入事件"},{"name":"onDelete","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"字符串或 ReactNode 自定义标题"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-on-primary","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#16110d"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","数字键盘"],"title":"数字键盘","section":"基础用法","description":"通过 `visible` 和 `onVisibleChange` 控制键盘显示,通过 `value` 和 `onChange` 管理输入内容。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"打开键盘\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"打开键盘\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","确认按钮"],"title":"确认按钮","section":"组件样式","description":"通过 `title` 设置键盘顶部提示,使用 `visible` 控制显示状态。","language":"tsx","code":"<Keyboard visible={false} title=\"请输入金额\" />\n","blocks":[{"language":"tsx","code":"<Keyboard visible={false} title=\"请输入金额\" />\n"}]}],"allowUnknownProps":false},{"name":"Loading","id":"loading","label":"Loading 加载指示器","category":"反馈","categoryId":"feedback","kind":"component","description":"加载指示器用于告知用户正在处理任务,支持圆环、旋转线条、圆点和波浪样式。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Loading.tsx","docPath":"docs/ui/components/loading.md","doc":"# Loading 加载指示器\n\n加载指示器用于告知用户正在处理任务,支持圆环、旋转线条、圆点和波浪样式。\n\n```tsx\nimport { Loading } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 加载动画\n\n通过 `type` 设置动画,支持 `circular`、`spinner`、`dots` 和 `wave`。\n\n```tsx\n<Loading type=\"circular\" />\n<Loading type=\"spinner\" />\n<Loading type=\"dots\" />\n<Loading type=\"wave\" />\n```\n\n## 组件样式\n\n### 颜色与尺寸\n\n通过 `color` 设置颜色,通过 `size` 设置尺寸。\n\n```tsx\n<Loading color=\"#12b886\" size={32} />\n```\n\n## 内容形态\n\n### 加载文案\n\n通过 `text` 设置加载文案,设置 `direction=\"horizontal\"` 使用横向排列。\n\n```tsx\n<Loading text=\"加载中\" />\n<Loading text=\"加载中\" direction=\"horizontal\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 渐变圆环、十二条旋转指示器、三圆点和四柱波形 | `LoadingType` | `'circular'` |\n| color | 动画及默认文字色;圆环SVG使用字面颜色,不使用CSS变量或currentColor | `string` | `'#1c64fd'` |\n| size | 非负数、数字字符串、px/rpx/rem/vw/vh;非法值回退28px,rpx按750设计宽换算vw | `LoadingSize` | `28` |\n| text | 加载文字;children优先 | `string` | — |\n| label | 旧文字别名,优先级children、text、label;使用label且未指定direction时保留水平排列、8px间距及原13px文字 | `string` | — |\n| children | 文字或自定义内容;自定义内容自行使用text包裹文字 | `ReactNode` | — |\n| direction | 指示器与文字方向,间隔6px | `'vertical' \\| 'horizontal'` | — |\n| className | 根样式;动画颜色通过color设置 | `string` | `''` |\n| spinnerClassName | 动画容器样式类 | `string` | `''` |\n| style | 根样式;动画颜色通过color设置 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 文字或自定义内容;自定义内容自行使用text包裹文字 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type LoadingType = 'circular' | 'spinner' | 'dots' | 'wave';\n\nexport type LoadingSize = 'small' | 'medium' | 'large' | (string & {}) | number;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Loading 组件源码](./sources/loading/Loading.tsx.txt) · [示例源码](./sources/loading/demo.tsx.txt) · [文档源码](./sources/loading/docs.md.txt)\n","demoSource":"import { Loading } from 'daisu-ui';\nimport type { LoadingType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst types: readonly LoadingType[] = ['circular', 'spinner', 'dots', 'wave'];\nexport function LoadingExample() {\n return <view className=\"demo-loading-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"类型\"><view className=\"demo-loading-row\">{types.map(type => <Loading key={type} type={type} />)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"颜色\"><view className=\"demo-loading-row\">{types.map(type => <Loading key={type} type={type} color=\"#ff357c\" />)}</view></ExampleBlock>\n <ExampleBlock title=\"大小\">{[20, 30, '50px'].map(size => <view key={String(size)} className=\"demo-loading-row\">{types.map(type => <Loading key={type} type={type} size={size} />)}</view>)}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"内容形态\">\n <ExampleBlock title=\"显示文字\"><view className=\"demo-loading-row\"><Loading text=\"加载中...\" />{(['circular', 'spinner', 'wave'] as const).map((type, index) => <Loading key={index} type={type}>加载中...</Loading>)}</view></ExampleBlock>\n <ExampleBlock title=\"水平方向\"><view className=\"demo-loading-row demo-loading-horizontal\"><Loading direction=\"horizontal\" text=\"加载中...\" />{(['circular', 'spinner', 'wave'] as const).map((type, index) => <Loading key={index} type={type} direction=\"horizontal\">加载中...</Loading>)}</view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"type","type":"LoadingType","optional":true,"description":"渐变圆环、十二条旋转指示器、三圆点和四柱波形","defaultValue":"'circular'","values":["circular","spinner","dots","wave"]},{"name":"color","type":"string","optional":true,"description":"动画及默认文字色;圆环SVG使用字面颜色,不使用CSS变量或currentColor","defaultValue":"'#1c64fd'"},{"name":"size","type":"LoadingSize","optional":true,"description":"非负数、数字字符串、px/rpx/rem/vw/vh;非法值回退28px,rpx按750设计宽换算vw","defaultValue":"28"},{"name":"text","type":"string","optional":true,"description":"加载文字;children优先"},{"name":"label","type":"string","optional":true,"description":"旧文字别名,优先级children、text、label;使用label且未指定direction时保留水平排列、8px间距及原13px文字"},{"name":"direction","type":"'vertical' | 'horizontal'","optional":true,"description":"指示器与文字方向,间隔6px","defaultValue":"label !== undefined ? 'horizontal' : 'vertical'","values":["vertical","horizontal"]},{"name":"className","type":"string","optional":true,"description":"根样式;动画颜色通过color设置","defaultValue":"''"},{"name":"spinnerClassName","type":"string","optional":true,"description":"动画容器样式类","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根样式;动画颜色通过color设置"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"文字或自定义内容;自定义内容自行使用text包裹文字"}],"methods":[],"cssVars":[{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","加载动画"],"title":"加载动画","section":"组件类型","description":"通过 `type` 设置动画,支持 `circular`、`spinner`、`dots` 和 `wave`。","language":"tsx","code":"<Loading type=\"circular\" />\n<Loading type=\"spinner\" />\n<Loading type=\"dots\" />\n<Loading type=\"wave\" />\n","blocks":[{"language":"tsx","code":"<Loading type=\"circular\" />\n<Loading type=\"spinner\" />\n<Loading type=\"dots\" />\n<Loading type=\"wave\" />\n"}]},{"name":"demo-2","aliases":["demo-2","颜色与尺寸"],"title":"颜色与尺寸","section":"组件样式","description":"通过 `color` 设置颜色,通过 `size` 设置尺寸。","language":"tsx","code":"<Loading color=\"#12b886\" size={32} />\n","blocks":[{"language":"tsx","code":"<Loading color=\"#12b886\" size={32} />\n"}]},{"name":"demo-3","aliases":["demo-3","加载文案"],"title":"加载文案","section":"内容形态","description":"通过 `text` 设置加载文案,设置 `direction=\"horizontal\"` 使用横向排列。","language":"tsx","code":"<Loading text=\"加载中\" />\n<Loading text=\"加载中\" direction=\"horizontal\" />\n","blocks":[{"language":"tsx","code":"<Loading text=\"加载中\" />\n<Loading text=\"加载中\" direction=\"horizontal\" />\n"}]}],"allowUnknownProps":false},{"name":"Loadmore","id":"loadmore","label":"loadmore 加载更多","category":"数据展示","categoryId":"display","kind":"component","description":"加载更多用于展示分页列表的加载中、全部加载和失败重试状态。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Loadmore.tsx","docPath":"docs/ui/components/loadmore.md","doc":"# loadmore 加载更多\n\n加载更多用于展示分页列表的加载中、全部加载和失败重试状态。\n\n```tsx\nimport { Loadmore } from 'daisu-ui';\n```\n\n## 组件状态\n\n### 分页状态\n\n通过 `state` 在 `loading`、`finished` 和 `error` 之间切换,`onReload` 响应失败重试。\n\n```tsx\n<Loadmore state=\"loading\" />\n<Loadmore state=\"finished\" />\n<Loadmore\n state=\"error\"\n onReload={() => {\n 'background only';\n console.log('重试加载');\n }}\n/>\n```\n\n## 内容形态\n\n### 自定义文案\n\n通过 `finishedText` 设置全部加载完成后的文案。\n\n```tsx\n<Loadmore state=\"finished\" finishedText=\"已经到底啦\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| state | 加载中、完成、错误;未设置时保留容器并不显示状态内容 | `LoadmoreState` | — |\n| loadingText | 加载中默认文字 | `string` | `'正在努力加载中...'` |\n| finishedText | 完成文字,默认复用公共Divider | `string` | `'已加载完毕'` |\n| errorText | 错误文字;独立“点击重试”提示不包含在此参数中 | `string` | `'加载失败'` |\n| loadingProps | 传递给公共Loading;自动保留ui-loadmore-loading类名并追加调用方className;默认28px圆环 | `LoadingProps` | — |\n| loading | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | `ReactNode` | — |\n| finished | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | `ReactNode` | — |\n| error | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | `ReactNode` | — |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onReload | 仅error状态点击整个容器触发,支持自定义错误内容;组件不自动改状态或发请求 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| loading | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | ReactNode |\n| finished | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | ReactNode |\n| error | 各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type LoadmoreState = 'loading' | 'finished' | 'error';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Loadmore 组件源码](./sources/loadmore/Loadmore.tsx.txt) · [示例源码](./sources/loadmore/demo.tsx.txt) · [文档源码](./sources/loadmore/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { List } from '@lynx-js/lynx-ui';\nimport { Loadmore } from 'daisu-ui';\nimport type { LoadmoreState } from 'daisu-ui';\nimport cat from '../../../assets/demo-cat.png';\n\nexport function LoadmoreExample() {\n const [count, setCount] = useState(15);\n const [state, setState] = useState<LoadmoreState>('loading');\n const total = useRef(15);\n const status = useRef<LoadmoreState>('loading');\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => { if (timer.current !== undefined) clearTimeout(timer.current); }, []);\n const load = (retry = false) => {\n 'background only';\n if (timer.current !== undefined || status.current === 'finished' || (status.current === 'error' && !retry)) return;\n if (total.current >= 60) { status.current = 'finished'; setState('finished'); return; }\n if (total.current === 45 && !retry) { status.current = 'error'; setState('error'); return; }\n status.current = 'loading'; setState('loading');\n timer.current = setTimeout(() => {\n 'background only';\n timer.current = undefined;\n total.current = Math.min(60, total.current + 15);\n setCount(total.current);\n }, 200);\n };\n return <view className=\"demo-loadmore-page\"><List listId=\"demo-loadmore-list\" listType=\"single\" spanCount={1} scrollOrientation=\"vertical\" className=\"demo-loadmore-list\" onScrollToLower={() => { 'background only'; load(); }}>\n {Array.from({ length: count }, (_, index) => <list-item key={index} item-key={`loadmore-${index}`} estimated-main-axis-size-px={98} style={{ height: '98px' }}><view className=\"demo-loadmore-item\"><image className=\"demo-loadmore-image\" src={cat} mode=\"scaleToFill\" /><text className=\"demo-loadmore-content\">{`这是一条测试${index + 1}1`}</text><view className=\"demo-loadmore-line\" /></view></list-item>)}\n <list-item item-key=\"loadmore-footer\" estimated-main-axis-size-px={48}><Loadmore state={state} onReload={() => { 'background only'; load(true); }} /></list-item>\n </List></view>;\n}\n","props":[{"name":"state","type":"LoadmoreState","optional":true,"description":"加载中、完成、错误;未设置时保留容器并不显示状态内容","values":["error","loading","finished"]},{"name":"loadingText","type":"string","optional":true,"description":"加载中默认文字","defaultValue":"'正在努力加载中...'"},{"name":"finishedText","type":"string","optional":true,"description":"完成文字,默认复用公共Divider","defaultValue":"'已加载完毕'"},{"name":"errorText","type":"string","optional":true,"description":"错误文字;独立“点击重试”提示不包含在此参数中","defaultValue":"'加载失败'"},{"name":"loadingProps","type":"LoadingProps","optional":true,"description":"传递给公共Loading;自动保留ui-loadmore-loading类名并追加调用方className;默认28px圆环"},{"name":"loading","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"},{"name":"finished","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"},{"name":"error","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onReload","type":"() => void","optional":true,"description":"仅error状态点击整个容器触发,支持自定义错误内容;组件不自动改状态或发请求"}],"slots":[{"name":"loading","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"},{"name":"finished","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"},{"name":"error","type":"ReactNode","optional":true,"description":"各状态插槽;参数存在时替换该状态全部默认内容,支持0/空字符串等值;原始文字自动包裹text"}],"methods":[],"cssVars":[{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","分页状态"],"title":"分页状态","section":"组件状态","description":"通过 `state` 在 `loading`、`finished` 和 `error` 之间切换,`onReload` 响应失败重试。","language":"tsx","code":"<Loadmore state=\"loading\" />\n<Loadmore state=\"finished\" />\n<Loadmore\n state=\"error\"\n onReload={() => {\n 'background only';\n console.log('重试加载');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Loadmore state=\"loading\" />\n<Loadmore state=\"finished\" />\n<Loadmore\n state=\"error\"\n onReload={() => {\n 'background only';\n console.log('重试加载');\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义文案"],"title":"自定义文案","section":"内容形态","description":"通过 `finishedText` 设置全部加载完成后的文案。","language":"tsx","code":"<Loadmore state=\"finished\" finishedText=\"已经到底啦\" />\n","blocks":[{"language":"tsx","code":"<Loadmore state=\"finished\" finishedText=\"已经到底啦\" />\n"}]}],"allowUnknownProps":false},{"name":"Navbar","id":"navbar","label":"Navbar 导航栏","category":"导航","categoryId":"navigation","kind":"component","description":"导航栏用于展示页面标题、返回入口和右侧操作,支持固定布局、自定义内容与胶囊导航。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Navbar.tsx","docPath":"docs/ui/components/navbar.md","doc":"# Navbar 导航栏\n\n导航栏用于展示页面标题、返回入口和右侧操作,支持固定布局、自定义内容与胶囊导航。\n\n```tsx\nimport { Navbar, NavbarCapsule } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 标准导航栏\n\n设置 `variant=\"standard\"` 使用标准样式,通过 `title` 设置标题,`leftArrow` 显示返回箭头。\n\n```tsx\n<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n```\n\n## 内容形态\n\n### 右侧操作\n\n通过 `rightText` 设置右侧文字,通过 `onRightTap` 响应点击。\n\n```tsx\n<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n```\n\n## 布局能力\n\n### 固定导航栏\n\n设置 `fixed` 固定在顶部,配合 `placeholder` 为页面内容保留高度。\n\n```tsx\n<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n```\n\n## Attributes 属性\n\n### Navbar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 字符串标题单行省略,节点对应 title 插槽 | `ReactNode` | `''` |\n| variant | business沿用56px左对齐标题和圆形返回;standard为44px居中标题 | `'business' \\| 'standard'` | `'business'` |\n| rightLabel | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | `string` | — |\n| rightDisabled | 两侧降低透明度并禁止事件 | `boolean` | `false` |\n| rightContent | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | `ReactNode` | — |\n| statusBarHeight | Flutter / H5 宿主注入,非负 px;不开启安全区时不使用 | `number` | `0` |\n| leftText | 两侧文案 | `string` | `''` |\n| rightText | 两侧文案 | `string` | — |\n| leftArrow | 业务圆形返回或standard的24px箭头 | `boolean` | — |\n| bordered | 底部半像素边框,默认跟随当前在线 Demo 源码 | `boolean` | `false` |\n| fixed | 顶部固定,固定时生成对应变体及安全区的等高占位 | `boolean` | `false` |\n| placeholder | 顶部固定,固定时生成对应变体及安全区的等高占位 | `boolean` | `false` |\n| zIndex | 层级 | `number` | `10` |\n| safeAreaInsetTop | 启用宿主传入的顶部安全区,保留原statusBarHeight行为 | `boolean` | — |\n| leftDisabled | 两侧降低透明度并禁止事件 | `boolean` | `false` |\n| left | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| right | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| capsule | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| className | 自定义类,可覆盖背景等样式 | `string` | `''` |\n\n### NavbarCapsule\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | `false` |\n| className | 自定义类,可覆盖背景等样式 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Navbar.onBack | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| Navbar.onRight | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| Navbar.onLeftTap | 对应 click-left / click-right,不内置跳转 | () => void |\n| Navbar.onRightTap | 对应 click-left / click-right,不内置跳转 | () => void |\n| NavbarCapsule.onBack | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| NavbarCapsule.onBackHome | 对应操作发生时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Navbar.title | 字符串标题单行省略,节点对应 title 插槽 | ReactNode |\n| Navbar.rightContent | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | ReactNode |\n| Navbar.left | 自定义内容;capsule 优先于 left | ReactNode |\n| Navbar.right | 自定义内容;capsule 优先于 left | ReactNode |\n| Navbar.capsule | 自定义内容;capsule 优先于 left | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Navbar 组件源码](./sources/navbar/Navbar.tsx.txt) · [NavbarCapsule 组件源码](./sources/navbar/Navbar.tsx.txt) · [示例源码](./sources/navbar/demo.tsx.txt) · [文档源码](./sources/navbar/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Icon, Navbar, NavbarCapsule, SyncedInput } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function NavigationExample({ onBack, onHome }: { onBack: () => void; onHome: () => void }) {\n const [keyword, setKeyword] = useState('');\n const [notice, setNotice] = useState('');\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => clearTimeout(timer.current), []);\n const show = () => { 'background only'; clearTimeout(timer.current); setNotice('按钮'); timer.current = setTimeout(() => setNotice(''), 1500); };\n return <view className=\"demo-navbar-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\" noPadding><Navbar variant=\"standard\" title=\"标题\" /></ExampleBlock>\n <ExampleBlock title=\"返回上级\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" leftArrow onLeftTap={onBack} /></ExampleBlock>\n <ExampleBlock title=\"右侧按钮\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" leftArrow rightText=\"按钮\" onLeftTap={onBack} onRightTap={show} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用按钮\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" rightText=\"按钮\" leftArrow leftDisabled rightDisabled onLeftTap={onBack} onRightTap={show} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\">\n <ExampleBlock title=\"使用插槽\" noPadding><Navbar variant=\"standard\" title=\"标题\" left={<Icon name=\"left\" size={24} />} right={<Icon name=\"search-line\" size={18} />} onLeftTap={onBack} /></ExampleBlock>\n <ExampleBlock title=\"胶囊样式\" noPadding><Navbar variant=\"standard\" title=\"标题\" rightText=\"设置\" capsule={<NavbarCapsule onBack={onBack} onBackHome={onHome} />} /></ExampleBlock>\n <ExampleBlock title=\"带搜索栏\" noPadding><Navbar variant=\"standard\" leftText=\"返回\" leftArrow rightText=\"设置\" title={<view className=\"demo-navbar-search\"><Icon name=\"search-line\" size={16} color=\"#4e5369\" /><SyncedInput value={keyword} onInput={setKeyword} placeholder=\"搜索\" maxlength={100} className=\"demo-navbar-search-input\" /></view>} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"原有默认样式\"><ExampleBlock title=\"默认导航栏(56px)\" noPadding><Navbar title=\"医疗机构备案\" onBack={onBack} rightLabel=\"保存\" onRight={show} /></ExampleBlock></DemoGroup>\n <view className=\"demo-navbar-spacer\" />\n {notice ? <view className=\"demo-cell-toast\" user-interaction-enabled={false}><text>{notice}</text></view> : null}\n </view>;\n}\n","props":[{"name":"title","type":"ReactNode","optional":true,"description":"字符串标题单行省略,节点对应 title 插槽","defaultValue":"''"},{"name":"variant","type":"'business' | 'standard'","optional":true,"description":"business沿用56px左对齐标题和圆形返回;standard为44px居中标题","defaultValue":"'business'","values":["business","standard"]},{"name":"rightLabel","type":"string","optional":true,"description":"保持兼容;新参数onLeftTap/onRightTap、rightText/right优先"},{"name":"rightDisabled","type":"boolean","optional":true,"description":"两侧降低透明度并禁止事件","defaultValue":"false","values":[false,true]},{"name":"rightContent","type":"ReactNode","optional":true,"description":"保持兼容;新参数onLeftTap/onRightTap、rightText/right优先"},{"name":"statusBarHeight","type":"number","optional":true,"description":"Flutter / H5 宿主注入,非负 px;不开启安全区时不使用","defaultValue":"0"},{"name":"leftText","type":"string","optional":true,"description":"两侧文案","defaultValue":"''"},{"name":"rightText","type":"string","optional":true,"description":"两侧文案"},{"name":"leftArrow","type":"boolean","optional":true,"description":"业务圆形返回或standard的24px箭头","values":[false,true]},{"name":"bordered","type":"boolean","optional":true,"description":"底部半像素边框,默认跟随当前在线 Demo 源码","defaultValue":"false","values":[false,true]},{"name":"fixed","type":"boolean","optional":true,"description":"顶部固定,固定时生成对应变体及安全区的等高占位","defaultValue":"false","values":[false,true]},{"name":"placeholder","type":"boolean","optional":true,"description":"顶部固定,固定时生成对应变体及安全区的等高占位","defaultValue":"false","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"层级","defaultValue":"10"},{"name":"safeAreaInsetTop","type":"boolean","optional":true,"description":"启用宿主传入的顶部安全区,保留原statusBarHeight行为","values":[false,true]},{"name":"leftDisabled","type":"boolean","optional":true,"description":"两侧降低透明度并禁止事件","defaultValue":"false","values":[false,true]},{"name":"left","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"},{"name":"right","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"},{"name":"capsule","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"},{"name":"className","type":"string","optional":true,"description":"自定义类,可覆盖背景等样式","defaultValue":"''"}],"events":[{"name":"onBack","type":"() => void","optional":true,"description":""},{"name":"onRight","type":"() => void","optional":true,"description":""},{"name":"onLeftTap","type":"() => void","optional":true,"description":""},{"name":"onRightTap","type":"() => void","optional":true,"description":""}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"字符串标题单行省略,节点对应 title 插槽","defaultValue":"''"},{"name":"rightContent","type":"ReactNode","optional":true,"description":"保持兼容;新参数onLeftTap/onRightTap、rightText/right优先"},{"name":"left","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"},{"name":"right","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"},{"name":"capsule","type":"ReactNode","optional":true,"description":"自定义内容;capsule 优先于 left"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","标准导航栏"],"title":"标准导航栏","section":"组件类型","description":"设置 `variant=\"standard\"` 使用标准样式,通过 `title` 设置标题,`leftArrow` 显示返回箭头。","language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","右侧操作"],"title":"右侧操作","section":"内容形态","description":"通过 `rightText` 设置右侧文字,通过 `onRightTap` 响应点击。","language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","固定导航栏"],"title":"固定导航栏","section":"布局能力","description":"设置 `fixed` 固定在顶部,配合 `placeholder` 为页面内容保留高度。","language":"tsx","code":"<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n","blocks":[{"language":"tsx","code":"<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n"}]}],"allowUnknownProps":false},{"name":"NavbarCapsule","id":"navbar","label":"Navbar 导航栏","category":"导航","categoryId":"navigation","kind":"component","description":"导航栏用于展示页面标题、返回入口和右侧操作,支持固定布局、自定义内容与胶囊导航。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Navbar.tsx","docPath":"docs/ui/components/navbar.md","doc":"# Navbar 导航栏\n\n导航栏用于展示页面标题、返回入口和右侧操作,支持固定布局、自定义内容与胶囊导航。\n\n```tsx\nimport { Navbar, NavbarCapsule } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 标准导航栏\n\n设置 `variant=\"standard\"` 使用标准样式,通过 `title` 设置标题,`leftArrow` 显示返回箭头。\n\n```tsx\n<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n```\n\n## 内容形态\n\n### 右侧操作\n\n通过 `rightText` 设置右侧文字,通过 `onRightTap` 响应点击。\n\n```tsx\n<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n```\n\n## 布局能力\n\n### 固定导航栏\n\n设置 `fixed` 固定在顶部,配合 `placeholder` 为页面内容保留高度。\n\n```tsx\n<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n```\n\n## Attributes 属性\n\n### Navbar\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 字符串标题单行省略,节点对应 title 插槽 | `ReactNode` | `''` |\n| variant | business沿用56px左对齐标题和圆形返回;standard为44px居中标题 | `'business' \\| 'standard'` | `'business'` |\n| rightLabel | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | `string` | — |\n| rightDisabled | 两侧降低透明度并禁止事件 | `boolean` | `false` |\n| rightContent | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | `ReactNode` | — |\n| statusBarHeight | Flutter / H5 宿主注入,非负 px;不开启安全区时不使用 | `number` | `0` |\n| leftText | 两侧文案 | `string` | `''` |\n| rightText | 两侧文案 | `string` | — |\n| leftArrow | 业务圆形返回或standard的24px箭头 | `boolean` | — |\n| bordered | 底部半像素边框,默认跟随当前在线 Demo 源码 | `boolean` | `false` |\n| fixed | 顶部固定,固定时生成对应变体及安全区的等高占位 | `boolean` | `false` |\n| placeholder | 顶部固定,固定时生成对应变体及安全区的等高占位 | `boolean` | `false` |\n| zIndex | 层级 | `number` | `10` |\n| safeAreaInsetTop | 启用宿主传入的顶部安全区,保留原statusBarHeight行为 | `boolean` | — |\n| leftDisabled | 两侧降低透明度并禁止事件 | `boolean` | `false` |\n| left | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| right | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| capsule | 自定义内容;capsule 优先于 left | `ReactNode` | — |\n| className | 自定义类,可覆盖背景等样式 | `string` | `''` |\n\n### NavbarCapsule\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| disabled | 是否禁用 | `boolean` | `false` |\n| className | 自定义类,可覆盖背景等样式 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Navbar.onBack | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| Navbar.onRight | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| Navbar.onLeftTap | 对应 click-left / click-right,不内置跳转 | () => void |\n| Navbar.onRightTap | 对应 click-left / click-right,不内置跳转 | () => void |\n| NavbarCapsule.onBack | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | () => void |\n| NavbarCapsule.onBackHome | 对应操作发生时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Navbar.title | 字符串标题单行省略,节点对应 title 插槽 | ReactNode |\n| Navbar.rightContent | 保持兼容;新参数onLeftTap/onRightTap、rightText/right优先 | ReactNode |\n| Navbar.left | 自定义内容;capsule 优先于 left | ReactNode |\n| Navbar.right | 自定义内容;capsule 优先于 left | ReactNode |\n| Navbar.capsule | 自定义内容;capsule 优先于 left | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Navbar 组件源码](./sources/navbar/Navbar.tsx.txt) · [NavbarCapsule 组件源码](./sources/navbar/Navbar.tsx.txt) · [示例源码](./sources/navbar/demo.tsx.txt) · [文档源码](./sources/navbar/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Icon, Navbar, NavbarCapsule, SyncedInput } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function NavigationExample({ onBack, onHome }: { onBack: () => void; onHome: () => void }) {\n const [keyword, setKeyword] = useState('');\n const [notice, setNotice] = useState('');\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => clearTimeout(timer.current), []);\n const show = () => { 'background only'; clearTimeout(timer.current); setNotice('按钮'); timer.current = setTimeout(() => setNotice(''), 1500); };\n return <view className=\"demo-navbar-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\" noPadding><Navbar variant=\"standard\" title=\"标题\" /></ExampleBlock>\n <ExampleBlock title=\"返回上级\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" leftArrow onLeftTap={onBack} /></ExampleBlock>\n <ExampleBlock title=\"右侧按钮\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" leftArrow rightText=\"按钮\" onLeftTap={onBack} onRightTap={show} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用按钮\" noPadding><Navbar variant=\"standard\" title=\"标题\" leftText=\"返回\" rightText=\"按钮\" leftArrow leftDisabled rightDisabled onLeftTap={onBack} onRightTap={show} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\">\n <ExampleBlock title=\"使用插槽\" noPadding><Navbar variant=\"standard\" title=\"标题\" left={<Icon name=\"left\" size={24} />} right={<Icon name=\"search-line\" size={18} />} onLeftTap={onBack} /></ExampleBlock>\n <ExampleBlock title=\"胶囊样式\" noPadding><Navbar variant=\"standard\" title=\"标题\" rightText=\"设置\" capsule={<NavbarCapsule onBack={onBack} onBackHome={onHome} />} /></ExampleBlock>\n <ExampleBlock title=\"带搜索栏\" noPadding><Navbar variant=\"standard\" leftText=\"返回\" leftArrow rightText=\"设置\" title={<view className=\"demo-navbar-search\"><Icon name=\"search-line\" size={16} color=\"#4e5369\" /><SyncedInput value={keyword} onInput={setKeyword} placeholder=\"搜索\" maxlength={100} className=\"demo-navbar-search-input\" /></view>} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"原有默认样式\"><ExampleBlock title=\"默认导航栏(56px)\" noPadding><Navbar title=\"医疗机构备案\" onBack={onBack} rightLabel=\"保存\" onRight={show} /></ExampleBlock></DemoGroup>\n <view className=\"demo-navbar-spacer\" />\n {notice ? <view className=\"demo-cell-toast\" user-interaction-enabled={false}><text>{notice}</text></view> : null}\n </view>;\n}\n","props":[{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"自定义类,可覆盖背景等样式","defaultValue":"''"}],"events":[{"name":"onBack","type":"() => void","optional":true,"description":""},{"name":"onBackHome","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","标准导航栏"],"title":"标准导航栏","section":"组件类型","description":"设置 `variant=\"standard\"` 使用标准样式,通过 `title` 设置标题,`leftArrow` 显示返回箭头。","language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"页面标题\"\n leftArrow\n onBack={() => {\n 'background only';\n console.log('返回');\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","右侧操作"],"title":"右侧操作","section":"内容形态","description":"通过 `rightText` 设置右侧文字,通过 `onRightTap` 响应点击。","language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Navbar\n variant=\"standard\"\n title=\"编辑资料\"\n rightText=\"保存\"\n onRightTap={() => {\n 'background only';\n console.log('保存');\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","固定导航栏"],"title":"固定导航栏","section":"布局能力","description":"设置 `fixed` 固定在顶部,配合 `placeholder` 为页面内容保留高度。","language":"tsx","code":"<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n","blocks":[{"language":"tsx","code":"<Navbar variant=\"standard\" title=\"详情\" fixed placeholder bordered />\n"}]}],"allowUnknownProps":false},{"name":"NoticeBar","id":"notice-bar","label":"NoticeBar 通知栏","category":"反馈","categoryId":"feedback","kind":"component","description":"通知栏用于展示公告与提示信息,支持滚动、图标、关闭和点击反馈。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/NoticeBar.tsx","docPath":"docs/ui/components/notice-bar.md","doc":"# NoticeBar 通知栏\n\n通知栏用于展示公告与提示信息,支持滚动、图标、关闭和点击反馈。\n\n```tsx\nimport { NoticeBar } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础通知\n\n通过 `text` 设置通知内容。\n\n```tsx\n<NoticeBar text=\"温馨提示:请及时完善个人信息。\" />\n```\n\n## 组件样式\n\n### 自定义内容颜色\n\n通过 `color` 设置通知文字颜色。\n\n```tsx\n<NoticeBar text=\"系统将在今晚进行维护\" color=\"#f57f00\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | string或readonly string[],按数组顺序循环 | `string \\| readonly string[]` | `''` |\n| type | warning/info/danger,浅深配色 | `'warning' \\| 'info' \\| 'danger'` | `'warning'` |\n| scrollable | 水平滚动开关;即使文本短也滚动 | `boolean` | `true` |\n| delay | 每轮停留秒数,负值归0,非有限值回退1 | `number` | `1` |\n| speed | px/s,非正数/非有限值回退50 | `number` | `50` |\n| closable | 内置关闭按钮,关闭后移除并清理动画计时 | `boolean` | `false` |\n| wrapable | 水平且scrollable=false时允许多行;其他静止情况单行省略 | `boolean` | `false` |\n| direction | horizontal/vertical;垂直至少两条才滚动,scrollable仅控制水平方向 | `'horizontal' \\| 'vertical'` | `'horizontal'` |\n| prefix | 字符串作为公共Icon名称,也可传ReactNode | `ReactNode` | — |\n| suffix | 后缀ReactNode,提供时替代内置关闭按钮;false隐藏后缀 | `ReactNode` | — |\n| color | 文字/内置图标、背景颜色 | `string` | — |\n| backgroundColor | 文字/内置图标、背景颜色 | `string` | — |\n| children | 水平内容插槽,原始字符自动包原生text;垂直始终使用text数组 | `ReactNode` | — |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onClose | 点击关闭时一次通知 | () => void |\n| onNext | 每轮滚动结束后收到新索引,包括单条水平回到0 | (index: number) => void |\n| onClick | 内容点击 `{index,text}`;关闭不透传 | (event: NoticeBarClick) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 字符串作为公共Icon名称,也可传ReactNode | ReactNode |\n| suffix | 后缀ReactNode,提供时替代内置关闭按钮;false隐藏后缀 | ReactNode |\n| children | 水平内容插槽,原始字符自动包原生text;垂直始终使用text数组 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| reset | 重置状态 | () => void |\n\n## 数据类型\n\n```tsx\nexport type NoticeBarClick = { index: number; text: string };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-notice-bar-danger-bg` | 当前组件 |\n| `--cso-ui-notice-bar-info-bg` | 当前组件 |\n| `--cso-ui-notice-bar-radius` | 当前组件 |\n| `--cso-ui-notice-bar-warning-bg` | 当前组件 |\n\n## 源代码\n\n[NoticeBar 组件源码](./sources/notice-bar/NoticeBar.tsx.txt) · [示例源码](./sources/notice-bar/demo.tsx.txt) · [文档源码](./sources/notice-bar/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { Button, Icon, NoticeBar, Toast, useToast, useConfigProvider } from 'daisu-ui';\nimport type { NoticeBarClick, NoticeBarRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst poems=['芦叶满汀洲','寒沙带浅流','二十年重过南楼','柳下系船犹未稳','能几日','又中秋'];\nconst message='这是一条消息提示信息';\nexport function NoticeBarExample(){\n const ref=useRef<NoticeBarRef>(null),toast=useToast(),config=useConfigProvider();\n const click=({index,text}:NoticeBarClick)=>{ 'background only'; toast.info(`${index+1}:${text}`); };\n return <view className=\"demo-notice-bar-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock noPadding title=\"基本用法\"><NoticeBar text={message.repeat(3)} prefix=\"exclamation-circle-fill\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock noPadding title=\"类型修改\"><NoticeBar type=\"danger\" text={'当前网络不可用,请检查你的网络设置。'.repeat(2)} prefix=\"close-circle-fill\" className=\"demo-notice-bar-space\"/><NoticeBar type=\"info\" text={'点击查看信息详情,'.repeat(4)+'点击查看信息详情。'} prefix=\"info-circle-fill\"/></ExampleBlock><ExampleBlock noPadding title=\"可关闭的\"><NoticeBar text={Array(3).fill(message).join(',')+'。'} closable prefix=\"sound\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock noPadding title=\"禁止滚动\"><NoticeBar scrollable={false} text=\"欲买桂花同载酒,终不似少年游…\" prefix=\"stop\"/></ExampleBlock>\n <ExampleBlock noPadding title=\"插槽\"><NoticeBar scrollable={false} prefix={<Icon name=\"stop\" size={20} color={config.theme==='dark'?'#ffa94d':'#f57f00'}/>} suffix={<text className=\"demo-notice-bar-link\" bindtap={()=>{ 'background only';toast.info('查看通知详情'); }}>查看</text>}>通知被禁或时段内消息屏蔽可能造成消…</NoticeBar></ExampleBlock>\n <ExampleBlock noPadding title=\"多行展示\"><NoticeBar text={Array(3).fill(message).join(',').repeat(2)} wrapable scrollable={false}/></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock noPadding title=\"自定义颜色\"><NoticeBar text={Array(3).fill(message).join(',')} prefix=\"robot\" color={config.theme==='dark'?'#20c997':'#59cdaa'} backgroundColor={config.theme==='dark'?'#053c2c':'#f3fbf9'} className=\"demo-notice-bar-custom\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock noPadding title=\"多文本轮播\"><NoticeBar text={poems} prefix=\"thunderbolt\" onClick={click}/></ExampleBlock><ExampleBlock noPadding title=\"垂直滚动\"><NoticeBar text={poems} prefix=\"experiment\" direction=\"vertical\" delay={3} className=\"demo-notice-bar-space\" onClick={click}/><NoticeBar text=\"只有一条消息不会滚动\" prefix=\"experiment\" direction=\"vertical\" delay={3} className=\"demo-notice-bar-space\" onClick={click}/></ExampleBlock><ExampleBlock noPadding title=\"重置播放动画\"><NoticeBar ref={ref} text={poems} prefix=\"wifi\" direction=\"vertical\" delay={3} className=\"demo-notice-bar-space\"/><Button label=\"重置播放动画\" onTap={()=>{ 'background only';ref.current?.reset(); }}/></ExampleBlock></DemoGroup>\n <Toast {...toast.props}/>\n </view>;\n}\n","props":[{"name":"text","type":"string | readonly string[]","optional":true,"description":"string或readonly string[],按数组顺序循环","defaultValue":"''"},{"name":"type","type":"'warning' | 'info' | 'danger'","optional":true,"description":"warning/info/danger,浅深配色","defaultValue":"'warning'","values":["info","warning","danger"]},{"name":"scrollable","type":"boolean","optional":true,"description":"水平滚动开关;即使文本短也滚动","defaultValue":"true","values":[false,true]},{"name":"delay","type":"number","optional":true,"description":"每轮停留秒数,负值归0,非有限值回退1","defaultValue":"1"},{"name":"speed","type":"number","optional":true,"description":"px/s,非正数/非有限值回退50","defaultValue":"50"},{"name":"closable","type":"boolean","optional":true,"description":"内置关闭按钮,关闭后移除并清理动画计时","defaultValue":"false","values":[false,true]},{"name":"wrapable","type":"boolean","optional":true,"description":"水平且scrollable=false时允许多行;其他静止情况单行省略","defaultValue":"false","values":[false,true]},{"name":"direction","type":"'horizontal' | 'vertical'","optional":true,"description":"horizontal/vertical;垂直至少两条才滚动,scrollable仅控制水平方向","defaultValue":"'horizontal'","values":["vertical","horizontal"]},{"name":"prefix","type":"ReactNode","optional":true,"description":"字符串作为公共Icon名称,也可传ReactNode"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后缀ReactNode,提供时替代内置关闭按钮;false隐藏后缀"},{"name":"color","type":"string","optional":true,"description":"文字/内置图标、背景颜色"},{"name":"backgroundColor","type":"string","optional":true,"description":"文字/内置图标、背景颜色"},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onClose","type":"() => void","optional":true,"description":"点击关闭时一次通知"},{"name":"onNext","type":"(index: number) => void","optional":true,"description":"每轮滚动结束后收到新索引,包括单条水平回到0"},{"name":"onClick","type":"(event: NoticeBarClick) => void","optional":true,"description":"内容点击 {index,text};关闭不透传"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"字符串作为公共Icon名称,也可传ReactNode"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后缀ReactNode,提供时替代内置关闭按钮;false隐藏后缀"},{"name":"children","type":"ReactNode","optional":true,"description":"水平内容插槽,原始字符自动包原生text;垂直始终使用text数组"}],"methods":[{"name":"reset","description":"重置状态","type":"() => void"}],"cssVars":[{"name":"--cso-ui-notice-bar-danger-bg","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-notice-bar-info-bg","defaultValue":"#f5f8ff","description":""},{"name":"--cso-ui-notice-bar-radius","defaultValue":"0px","description":""},{"name":"--cso-ui-notice-bar-warning-bg","defaultValue":"#fff6eb","description":""}],"demos":[{"name":"basic","aliases":["demo-1","基础通知"],"title":"基础通知","section":"组件类型","description":"通过 `text` 设置通知内容。","language":"tsx","code":"<NoticeBar text=\"温馨提示:请及时完善个人信息。\" />\n","blocks":[{"language":"tsx","code":"<NoticeBar text=\"温馨提示:请及时完善个人信息。\" />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义内容颜色"],"title":"自定义内容颜色","section":"组件样式","description":"通过 `color` 设置通知文字颜色。","language":"tsx","code":"<NoticeBar text=\"系统将在今晚进行维护\" color=\"#f57f00\" />\n","blocks":[{"language":"tsx","code":"<NoticeBar text=\"系统将在今晚进行维护\" color=\"#f57f00\" />\n"}]}],"allowUnknownProps":false},{"name":"Notify","id":"notify","label":"Notify 消息通知","category":"反馈","categoryId":"feedback","kind":"component","description":"消息通知用于展示页面级状态,支持成功、警告、失败以及不同位置和外观。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Notify.tsx","docPath":"docs/ui/components/notify.md","doc":"# Notify 消息通知\n\n消息通知用于展示页面级状态,支持成功、警告、失败以及不同位置和外观。\n\n```tsx\nimport { Notify } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 绑定通知实例\n\n将 `useNotify()` 返回的 `props` 绑定到 `Notify`,通过 `showNotify()` 显示通知。\n\n```tsx\nimport { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n```\n\n## 组件状态\n\n### 成功通知\n\n调用 `showNotify()` 时设置 `type=\"success\"`,通过 `message` 指定通知文案。\n\n```tsx\nconst notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | primary / success / warning / danger | `NotifyType` | — |\n| message | string 或 number;默认内容单行省略,复杂内容使用 children | `string \\| number` | — |\n| duration | 显示时长,ms;≤0 或非有限值不自动关闭,不含离场动画时间 | `number` | — |\n| position | top / bottom | `NotifyPosition` | — |\n| color | 自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色 | `string` | — |\n| background | 自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色 | `string` | — |\n| zIndex | 浮层层级 | `number` | — |\n| safeHeight | 顶部偏移;数字及纯数字字符串为 px,rpx 转为 vw,其他有效 CSS 长度直接传递 | `number \\| string` | — |\n| safeAreaBottom | 宿主提供的底部安全区,有限非负 px;仅 bottom 使用 | `number` | — |\n| rootPortal | 使用现有原生 Portal 逃离滚动与裁剪容器 | `boolean` | — |\n| closable | 展示关闭按钮,catchtap 阻止其触发 onClick | `boolean` | — |\n| variant | filled 使用状态浅色背景;floating 使用表面色、12px 外边距、8px 圆角与静态阴影 | `NotifyVariant` | — |\n| className | 通知内容容器的类与样式 | `string` | — |\n| style | 通知内容容器的类与样式 | `CSSProperties` | — |\n| visible | 受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态 | `boolean` | `false` |\n| requestKey | 内容连续展示时递增,以重新开始计时;useNotify 自动管理 | `number` | `0` |\n| options | 同名 NotifyOptions 覆盖组件直接传入的默认选项;不含 visible、children 等控制属性 | `NotifyOptions` | — |\n| children | 替换 message,可放公共组件及多行自定义内容 | `ReactNode` | — |\n| prefix | 默认类型图标;传 null 隐藏,ReactNode 自定义 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onClick | 点击通知正文;参数为 Lynx TouchEvent,不会自动关闭 | (event: TouchEvent) => void |\n| onOpened | 入场 / 离场动画完成后调用;快速反向会取消过期阶段 | () => void |\n| onClosed | 入场 / 离场动画完成后调用;快速反向会取消过期阶段 | () => void |\n| onChange | 受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态 | (visible: boolean) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 替换 message,可放公共组件及多行自定义内容 | ReactNode |\n| prefix | 默认类型图标;传 null 隐藏,ReactNode 自定义 | ReactNode |\n| renderClose | `(close: () => void) => ReactNode`,closable 为 true 时使用 | (close: () => void) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type NotifyType = 'primary' | 'success' | 'warning' | 'danger';\n\nexport type NotifyPosition = 'top' | 'bottom';\n\nexport type NotifyVariant = 'filled' | 'floating';\n\nexport type NotifyOptions = {\n type?: NotifyType;\n message?: string | number;\n duration?: number;\n position?: NotifyPosition;\n color?: string;\n background?: string;\n zIndex?: number;\n safeHeight?: number | string;\n safeAreaBottom?: number;\n rootPortal?: boolean;\n closable?: boolean;\n variant?: NotifyVariant;\n className?: string;\n style?: CSSProperties;\n onClick?: (event: TouchEvent) => void;\n onOpened?: () => void;\n onClosed?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-danger-soft` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-primary-soft` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-success-soft` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-warning` | 共享主题 |\n| `--cso-ui-warning-soft` | 共享主题 |\n\n## 源代码\n\n[Notify 组件源码](./sources/notify/Notify.tsx.txt) · [示例源码](./sources/notify/demo.tsx.txt) · [文档源码](./sources/notify/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, ConfigProvider, Icon, Notify, useConfigProvider, useNotify } from 'daisu-ui';\nimport type { NotifyType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst types: { type:NotifyType; title:string }[] = [{ type:'primary',title:'主要通知' },{ type:'success',title:'成功通知' },{ type:'danger',title:'危险通知' },{ type:'warning',title:'警告通知' }];\nexport function NotifyExample() {\n const notify = useNotify(), [visible,setVisible] = useState(false), [requestKey,setRequestKey] = useState(0), config = useConfigProvider();\n const dark = config.theme === 'dark';\n const themeVars = { primary:dark ? '#5b90ff' : '#1c64fd', success:dark ? '#20c997' : '#12b886', warning:dark ? '#ffa94d' : '#f57f00', danger:dark ? '#ff6b6b' : '#f14646', surface:dark ? '#000' : '#fff', text:dark ? '#f7f8fa' : '#1d1f29', '--cso-ui-primary-soft':dark ? '#0d2a77' : '#f5f8ff', '--cso-ui-success-soft':dark ? '#053c2c' : '#f3fbf9', '--cso-ui-warning-soft':dark ? '#542905' : '#fff6eb', '--cso-ui-danger-soft':dark ? '#571111' : '#fff5f5' };\n return <view className=\"demo-notify-page\">\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"基础用法\" noPadding><CellGroup><Cell title=\"基础用法\" arrow onTap={() => { 'background only'; notify.showNotify('测试'); }} /></CellGroup></ExampleBlock><ExampleBlock title=\"自定义配置\" noPadding><CellGroup><Cell title=\"自定义颜色\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义颜色',color:config.theme === 'dark' ? '#ff6b6b' : '#f14646',background:'var(--cso-ui-danger-soft)' }); }} /><Cell title=\"自定义位置\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义位置',position:'bottom' }); }} /><Cell title=\"自定义时长\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义时长',duration:1000 }); }} /><Cell title=\"显示关闭按钮\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',closable:true,duration:0 }); }} /></CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"通知类型\" noPadding><CellGroup>{types.map(({type,title}) => <Cell key={type} title={title} arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',type }); }} />)}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"悬浮通知\" noPadding><CellGroup>{types.map(({type,title}) => <Cell key={type} title={title} arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',type,variant:'floating',closable:true }); }} />)}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"使用 Notify 组件\" noPadding><CellGroup><Cell title=\"使用 Notify 组件\" arrow onTap={() => { 'background only'; setRequestKey(value => value+1); setVisible(true); }} /></CellGroup></ExampleBlock></DemoGroup>\n <ConfigProvider themeVars={themeVars}><Notify {...notify.props} safeHeight={44} rootPortal /><Notify visible={visible} onChange={setVisible} requestKey={requestKey} type=\"success\" duration={2000} safeHeight={44} rootPortal><view className=\"demo-notify-custom-content\"><Icon name=\"check-outline\" size={15} color={config.theme === 'dark' ? '#20c997' : '#12b886'} /><text>成功通知</text></view></Notify></ConfigProvider>\n </view>;\n}\n","props":[{"name":"type","type":"NotifyType","optional":true,"description":"primary / success / warning / danger","values":["primary","success","warning","danger"]},{"name":"message","type":"string | number","optional":true,"description":"string 或 number;默认内容单行省略,复杂内容使用 children"},{"name":"duration","type":"number","optional":true,"description":"显示时长,ms;≤0 或非有限值不自动关闭,不含离场动画时间"},{"name":"position","type":"NotifyPosition","optional":true,"description":"top / bottom","values":["bottom","top"]},{"name":"color","type":"string","optional":true,"description":"自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色"},{"name":"background","type":"string","optional":true,"description":"自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"safeHeight","type":"number | string","optional":true,"description":"顶部偏移;数字及纯数字字符串为 px,rpx 转为 vw,其他有效 CSS 长度直接传递"},{"name":"safeAreaBottom","type":"number","optional":true,"description":"宿主提供的底部安全区,有限非负 px;仅 bottom 使用"},{"name":"rootPortal","type":"boolean","optional":true,"description":"使用现有原生 Portal 逃离滚动与裁剪容器","values":[false,true]},{"name":"closable","type":"boolean","optional":true,"description":"展示关闭按钮,catchtap 阻止其触发 onClick","values":[false,true]},{"name":"variant","type":"NotifyVariant","optional":true,"description":"filled 使用状态浅色背景;floating 使用表面色、12px 外边距、8px 圆角与静态阴影","values":["filled","floating"]},{"name":"className","type":"string","optional":true,"description":"通知内容容器的类与样式"},{"name":"style","type":"CSSProperties","optional":true,"description":"通知内容容器的类与样式"},{"name":"visible","type":"boolean","optional":true,"description":"受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态","defaultValue":"false","values":[false,true]},{"name":"requestKey","type":"number","optional":true,"description":"内容连续展示时递增,以重新开始计时;useNotify 自动管理","defaultValue":"0"},{"name":"options","type":"NotifyOptions","optional":true,"description":"同名 NotifyOptions 覆盖组件直接传入的默认选项;不含 visible、children 等控制属性"},{"name":"prefix","type":"ReactNode","optional":true,"description":"默认类型图标;传 null 隐藏,ReactNode 自定义"}],"events":[{"name":"onClick","type":"(event: TouchEvent) => void","optional":true,"description":"点击通知正文;参数为 Lynx TouchEvent,不会自动关闭"},{"name":"onOpened","type":"() => void","optional":true,"description":"入场 / 离场动画完成后调用;快速反向会取消过期阶段"},{"name":"onClosed","type":"() => void","optional":true,"description":"入场 / 离场动画完成后调用;快速反向会取消过期阶段"},{"name":"onChange","type":"(visible: boolean) => void","optional":true,"description":"受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"替换 message,可放公共组件及多行自定义内容"},{"name":"prefix","type":"ReactNode","optional":true,"description":"默认类型图标;传 null 隐藏,ReactNode 自定义"},{"name":"renderClose","type":"(close: () => void) => ReactNode","optional":true,"description":"(close: () => void) => ReactNode,closable 为 true 时使用"}],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-danger-soft","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-soft","defaultValue":"#fff3eb","description":""},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-success-soft","defaultValue":"#f3fbf9","description":""},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"},{"name":"--cso-ui-warning-soft","defaultValue":"#fff6eb","description":""}],"demos":[{"name":"basic","aliases":["demo-1","绑定通知实例"],"title":"绑定通知实例","section":"基础用法","description":"将 `useNotify()` 返回的 `props` 绑定到 `Notify`,通过 `showNotify()` 显示通知。","language":"tsx","code":"import { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n","blocks":[{"language":"tsx","code":"import { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","成功通知"],"title":"成功通知","section":"组件状态","description":"调用 `showNotify()` 时设置 `type=\"success\"`,通过 `message` 指定通知文案。","language":"tsx","code":"const notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n","blocks":[{"language":"tsx","code":"const notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n"}]}],"allowUnknownProps":false},{"name":"NumberStepper","id":"number-stepper","label":"NumberStepper","category":"公共 API","categoryId":"api","kind":"component","description":"NumberStepper 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/NumberStepper.tsx","doc":"","props":[{"name":"value","type":"string","optional":false,"description":""},{"name":"min","type":"number","optional":true,"description":"","defaultValue":"0"},{"name":"max","type":"number","optional":true,"description":"","defaultValue":"Number.MAX_SAFE_INTEGER"},{"name":"step","type":"number","optional":true,"description":"","defaultValue":"1"},{"name":"disabled","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]}],"events":[{"name":"onChange","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Overlay","id":"overlay","label":"Overlay 遮罩层","category":"反馈","categoryId":"feedback","kind":"component","description":"遮罩层用于突出前景内容并阻隔背景交互,支持显示控制、过渡和自定义层级。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Overlay.tsx","docPath":"docs/ui/components/overlay.md","doc":"# Overlay 遮罩层\n\n遮罩层用于突出前景内容并阻隔背景交互,支持显示控制、过渡和自定义层级。\n\n```tsx\nimport { Overlay } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 点击关闭遮罩\n\n通过 `show` 控制遮罩显示,在 `onTap` 中更新显示状态即可关闭。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"显示遮罩\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Overlay\n show={show}\n onTap={() => {\n 'background only';\n setShow(false);\n }}\n/>\n```\n\n## 内容形态\n\n### 自定义内容\n\n将需要展示的前景内容放在遮罩子节点中。\n\n```tsx\n<Overlay show={false}>\n <view style={{ marginTop: '120px', padding: '20px' }}>\n <text>前景内容</text>\n </view>\n</Overlay>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| show | 受控显示,onTap 不自行改变 show | `boolean` | `false` |\n| duration | 毫秒、{enter,leave} 或 boolean(false 为0) | `TransitionProps['duration']` | `300` |\n| lockScroll | 原生 consume-slide-event 拦截全方向滑动,catchtouchmove 阻止事件冒泡 | `boolean` | `true` |\n| zIndex | 层级 | `number` | `10` |\n| rootPortal | 使用原生 createPortal,须在应用根提供 RootPortalHost | `boolean` | `false` |\n| children | 自定义类、CSSProperties、嵌入内容 | `ReactNode` | — |\n| className | 自定义类、CSSProperties、嵌入内容 | `string` | `''` |\n| style | 自定义类、CSSProperties、嵌入内容 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onBeforeEnter | 进入生命周期 | () => void |\n| onEnter | 进入生命周期 | () => void |\n| onAfterEnter | 进入生命周期 | () => void |\n| onBeforeLeave | 离开生命周期 | () => void |\n| onLeave | 离开生命周期 | () => void |\n| onAfterLeave | 离开生命周期 | () => void |\n| onTap | 点击遮罩;内容用 catchtap 阻止冒泡 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义类、CSSProperties、嵌入内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Overlay 组件源码](./sources/overlay/Overlay.tsx.txt) · [示例源码](./sources/overlay/demo.tsx.txt) · [文档源码](./sources/overlay/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Overlay, Switch } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function OverlayExample() {\n const [basic, setBasic] = useState(false);\n const [content, setContent] = useState(false);\n const [locked, setLocked] = useState(true);\n return <view className=\"demo-overlay-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-layer-trigger\"><Button label=\"显示遮罩层\" onTap={() => setBasic(true)} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"嵌入内容\"><view className=\"demo-layer-trigger\"><Button label=\"嵌入内容\" onTap={() => setContent(true)} /></view></ExampleBlock></DemoGroup>\n <Overlay show={basic} rootPortal onTap={() => setBasic(false)} />\n <Overlay show={content} rootPortal lockScroll={locked} onTap={() => setContent(false)}>\n <view className=\"demo-overlay-wrapper\"><view className=\"ui-demo-page demo-overlay-content\" catchtap={() => {}}>\n <view className=\"demo-overlay-lock-row\"><text className=\"demo-overlay-lock-label\">是否锁定背景滚动,锁定时蒙层里的内容也将无法滚动</text><Switch value={locked} size={22} onChange={({ value }) => setLocked(value === true)} accessibilityLabel=\"切换滚动锁定\" /></view>\n <scroll-view className=\"demo-overlay-scroll\" scroll-orientation=\"vertical\" scroll-y={!locked} enable-scroll={!locked}>{Array.from({ length: 10 }, (_, index) => <view className=\"demo-overlay-block\" key={index}><text>{index + 1}</text></view>)}</scroll-view>\n </view></view>\n </Overlay>\n </view>;\n}\n","props":[{"name":"show","type":"boolean","optional":true,"description":"受控显示,onTap 不自行改变 show","defaultValue":"false","values":[false,true]},{"name":"duration","type":"TransitionProps['duration']","optional":true,"description":"毫秒、{enter,leave} 或 boolean(false 为0)","defaultValue":"300"},{"name":"lockScroll","type":"boolean","optional":true,"description":"原生 consume-slide-event 拦截全方向滑动,catchtouchmove 阻止事件冒泡","defaultValue":"true","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"层级","defaultValue":"10"},{"name":"rootPortal","type":"boolean","optional":true,"description":"使用原生 createPortal,须在应用根提供 RootPortalHost","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"自定义类、CSSProperties、嵌入内容","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"自定义类、CSSProperties、嵌入内容"}],"events":[{"name":"onBeforeEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onAfterEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onBeforeLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onAfterLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onTap","type":"() => void","optional":true,"description":"点击遮罩;内容用 catchtap 阻止冒泡"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义类、CSSProperties、嵌入内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","点击关闭遮罩"],"title":"点击关闭遮罩","section":"基础用法","description":"通过 `show` 控制遮罩显示,在 `onTap` 中更新显示状态即可关闭。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"显示遮罩\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Overlay\n show={show}\n onTap={() => {\n 'background only';\n setShow(false);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"显示遮罩\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Overlay\n show={show}\n onTap={() => {\n 'background only';\n setShow(false);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义内容"],"title":"自定义内容","section":"内容形态","description":"将需要展示的前景内容放在遮罩子节点中。","language":"tsx","code":"<Overlay show={false}>\n <view style={{ marginTop: '120px', padding: '20px' }}>\n <text>前景内容</text>\n </view>\n</Overlay>\n","blocks":[{"language":"tsx","code":"<Overlay show={false}>\n <view style={{ marginTop: '120px', padding: '20px' }}>\n <text>前景内容</text>\n </view>\n</Overlay>\n"}]}],"allowUnknownProps":false},{"name":"PagedList","id":"paged-list","label":"PagedList","category":"公共 API","categoryId":"api","kind":"component","description":"The platform refresh element owns pull distance, threshold, pinning and rebound.","importFrom":"daisu-ui","source":"packages/daisu-ui/src/PagedList.tsx","doc":"","props":[{"name":"listId","type":"string","optional":false,"description":""},{"name":"listRef","type":"RefObject<FeedListRef | null>","optional":false,"description":""},{"name":"refreshing","type":"boolean","optional":false,"description":"","values":[false,true]},{"name":"footer","type":"ReactElement | null","optional":false,"description":""}],"events":[{"name":"onRefresh","type":"() => void","optional":false,"description":""},{"name":"onLoadMore","type":"() => void","optional":false,"description":""},{"name":"onLayoutComplete","type":"() => void","optional":true,"description":""}],"slots":[{"name":"children","type":"ReactNode","optional":false,"description":""}],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Pagination","id":"pagination","label":"Pagination 分页","category":"导航","categoryId":"navigation","kind":"component","description":"分页器用于切换有明确页数的数据,支持总条数、页大小、图标和自定义文案。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Pagination.tsx","docPath":"docs/ui/components/pagination.md","doc":"# Pagination 分页\n\n分页器用于切换有明确页数的数据,支持总条数、页大小、图标和自定义文案。\n\n```tsx\nimport { Pagination } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 受控分页\n\n通过 `value` 和 `onChange` 管理页码,`total` 设置总条数,`pageSize` 设置每页条数。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [page, setPage] = useState(1);\n\n<Pagination\n value={page}\n onChange={(value) => {\n 'background only';\n setPage(value);\n }}\n total={100}\n pageSize={10}\n/>\n```\n\n## 内容形态\n\n### 自定义翻页文案\n\n通过 `prevText` 和 `nextText` 设置翻页文案,`showMessage` 控制页码信息的显示。\n\n```tsx\n<Pagination totalPage={5} prevText=\"上一页\" nextText=\"下一页\" showMessage />\n```\n\n## 组件状态\n\n### 单页时隐藏\n\n设置 `hideIfOnePage`,只有一页数据时隐藏分页器。\n\n```tsx\n<Pagination total={8} pageSize={10} hideIfOnePage />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `number` | — |\n| defaultValue | 非受控模式的初始值 | `number` | `1` |\n| total | 数据总条数 | `number` | — |\n| totalPage | 总页数 | `number` | — |\n| pageSize | 每页条数 | `number` | `10` |\n| prevText | 上一步按钮文案 | `string` | `'上一页'` |\n| nextText | 下一步按钮文案 | `string` | `'下一页'` |\n| showIcon | 是否显示翻页图标 | `boolean` | `false` |\n| showMessage | 是否显示分页信息 | `boolean` | `false` |\n| hideIfOnePage | 只有一页时是否隐藏 | `boolean` | `true` |\n| buttonVariant | 翻页按钮外观 | `'text' \\| 'plain' \\| 'dashed' \\| 'base'` | `'text'` |\n| className | 根节点自定义类名 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (value: number) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderPrev | 自定义区域内容 | (state: PaginationRenderState) => ReactNode |\n| renderNext | 自定义区域内容 | (state: PaginationRenderState) => ReactNode |\n| renderSize | 自定义区域内容 | (state: PaginationRenderState) => ReactNode |\n| renderMessage | 自定义区域内容 | (state: PaginationRenderState) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type PaginationRenderState = {\n value: number;\n totalPage: number;\n total?: number;\n pageSize: number;\n prev: () => void;\n next: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Pagination 组件源码](./sources/pagination/Pagination.tsx.txt) · [示例源码](./sources/pagination/demo.tsx.txt) · [文档源码](./sources/pagination/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Pagination } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function PaginationExample() {\n const [pages, setPages] = useState([1,1,1,1,1,1,1]);\n const change = (index: number, value: number) => { 'background only'; setPages(values => values.map((page,i)=>i===index?value:page)); };\n return <view className=\"demo-pagination-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding><Pagination value={pages[0]} total={190} onChange={value=>{ 'background only'; change(0,value); }} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"按钮风格\" noPadding><view className=\"demo-pagination-stack\">{(['plain','dashed','base'] as const).map((variant,index)=><Pagination key={variant} value={pages[index+1]} total={190} buttonVariant={variant} onChange={value=>{ 'background only'; change(index+1,value); }} />)}</view></ExampleBlock>\n <ExampleBlock title=\"Icon图标\" noPadding><Pagination value={pages[4]} total={19} showIcon onChange={value=>{ 'background only'; change(4,value); }} /></ExampleBlock>\n <ExampleBlock title=\"文字提示\" noPadding><Pagination value={pages[5]} total={160} pageSize={20} showIcon showMessage onChange={value=>{ 'background only'; change(5,value); }} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"自定义插槽\" noPadding><Pagination value={pages[6]} total={190} showMessage onChange={value=>{ 'background only'; change(6,value); }} renderPrev={state=><Button label=\"上一页\" size=\"small\" tone=\"danger\" disabled={state.value<=1} onTap={state.prev}/>} renderNext={state=><Button label=\"下一页\" size=\"small\" tone=\"danger\" disabled={state.value>=state.totalPage} onTap={state.next}/>} renderSize={state=><><text className=\"demo-pagination-custom-current\">{state.value}</text><text className=\"ui-pagination-separator\">/</text><text className=\"demo-pagination-custom-total\">{state.totalPage}</text></>} renderMessage={state=><text className=\"demo-pagination-custom-message\">{`当前第${state.value}页,共${state.total}条数据`}</text>} /></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"value","type":"number","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"number","optional":true,"description":"非受控模式的初始值","defaultValue":"1"},{"name":"total","type":"number","optional":true,"description":"数据总条数"},{"name":"totalPage","type":"number","optional":true,"description":"总页数"},{"name":"pageSize","type":"number","optional":true,"description":"每页条数","defaultValue":"10"},{"name":"prevText","type":"string","optional":true,"description":"上一步按钮文案","defaultValue":"'上一页'"},{"name":"nextText","type":"string","optional":true,"description":"下一步按钮文案","defaultValue":"'下一页'"},{"name":"showIcon","type":"boolean","optional":true,"description":"是否显示翻页图标","defaultValue":"false","values":[false,true]},{"name":"showMessage","type":"boolean","optional":true,"description":"是否显示分页信息","defaultValue":"false","values":[false,true]},{"name":"hideIfOnePage","type":"boolean","optional":true,"description":"只有一页时是否隐藏","defaultValue":"true","values":[false,true]},{"name":"buttonVariant","type":"'text' | 'plain' | 'dashed' | 'base'","optional":true,"description":"翻页按钮外观","defaultValue":"'text'","values":["plain","dashed","text","base"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[{"name":"onChange","type":"(value: number) => void","optional":true,"description":"值发生变化时触发"}],"slots":[{"name":"renderPrev","type":"(state: PaginationRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderNext","type":"(state: PaginationRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderSize","type":"(state: PaginationRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderMessage","type":"(state: PaginationRenderState) => ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","受控分页"],"title":"受控分页","section":"组件类型","description":"通过 `value` 和 `onChange` 管理页码,`total` 设置总条数,`pageSize` 设置每页条数。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [page, setPage] = useState(1);\n\n<Pagination\n value={page}\n onChange={(value) => {\n 'background only';\n setPage(value);\n }}\n total={100}\n pageSize={10}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [page, setPage] = useState(1);\n\n<Pagination\n value={page}\n onChange={(value) => {\n 'background only';\n setPage(value);\n }}\n total={100}\n pageSize={10}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义翻页文案"],"title":"自定义翻页文案","section":"内容形态","description":"通过 `prevText` 和 `nextText` 设置翻页文案,`showMessage` 控制页码信息的显示。","language":"tsx","code":"<Pagination totalPage={5} prevText=\"上一页\" nextText=\"下一页\" showMessage />\n","blocks":[{"language":"tsx","code":"<Pagination totalPage={5} prevText=\"上一页\" nextText=\"下一页\" showMessage />\n"}]},{"name":"demo-3","aliases":["demo-3","单页时隐藏"],"title":"单页时隐藏","section":"组件状态","description":"设置 `hideIfOnePage`,只有一页数据时隐藏分页器。","language":"tsx","code":"<Pagination total={8} pageSize={10} hideIfOnePage />\n","blocks":[{"language":"tsx","code":"<Pagination total={8} pageSize={10} hideIfOnePage />\n"}]}],"allowUnknownProps":false},{"name":"parseRoutePath","id":"parse-route-path","label":"parseRoutePath","category":"公共 API","categoryId":"api","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router/location","source":"packages/daisu-ui/src/router/location.ts","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of a string."},{"name":"charAt","type":"string","optional":false,"description":"Returns the character at the specified index."},{"name":"charCodeAt","type":"number","optional":false,"description":"Returns the Unicode value of the character at the specified location."},{"name":"concat","type":"string","optional":false,"description":"Returns a string that contains the concatenation of two or more strings."},{"name":"indexOf","type":"number","optional":false,"description":"Returns the position of the first occurrence of a substring, or -1 if it is not present."},{"name":"lastIndexOf","type":"number","optional":false,"description":"Returns the last occurrence of a substring in the string, or -1 if it is not present."},{"name":"localeCompare","type":"number","optional":false,"description":"Determines whether two strings are equivalent in the current locale.\nDetermines whether two strings are equivalent in the current or specified locale."},{"name":"match","type":"RegExpMatchArray | null","optional":false,"description":"Matches a string with a regular expression, and returns an array containing the results of that search.\nMatches a string or an object that supports being matched against, and returns an array\ncontaining the results of that search, or null if no matches are found."},{"name":"replace","type":"string","optional":false,"description":"Replaces text in a string, using a regular expression or search string.\nPasses a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.\nReplaces text in a string, using an object that supports replacement within a string."},{"name":"search","type":"number","optional":false,"description":"Finds the first substring match in a regular expression search."},{"name":"slice","type":"string","optional":false,"description":"Returns a section of a string."},{"name":"split","type":"string[]","optional":false,"description":"Split a string into substrings using the specified separator and return them as an array."},{"name":"substring","type":"string","optional":false,"description":"Returns the substring at the specified location within a String object."},{"name":"toLowerCase","type":"string","optional":false,"description":"Converts all the alphabetic characters in a string to lowercase."},{"name":"toLocaleLowerCase","type":"string","optional":false,"description":"Converts all alphabetic characters to lowercase, taking into account the host environment's current locale."},{"name":"toUpperCase","type":"string","optional":false,"description":"Converts all the alphabetic characters in a string to uppercase."},{"name":"toLocaleUpperCase","type":"string","optional":false,"description":"Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale."},{"name":"trim","type":"string","optional":false,"description":"Removes the leading and trailing white space and line terminator characters from a string."},{"name":"length","type":"number","optional":false,"description":"Returns the length of a String object."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"substr","type":"string","optional":false,"description":"Gets a substring beginning at the specified location and having the specified length."},{"name":"valueOf","type":"string","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"codePointAt","type":"number | undefined","optional":false,"description":"Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\nvalue of the UTF-16 encoded code point starting at the string element at position pos in\nthe String resulting from converting this object to a String.\nIf there is no element at that position, the result is undefined.\nIf a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos."},{"name":"includes","type":"boolean","optional":false,"description":"Returns true if searchString appears as a substring of the result of converting this\nobject to a String, at one or more positions that are\ngreater than or equal to position; otherwise, returns false."},{"name":"endsWith","type":"boolean","optional":false,"description":"Returns true if the sequence of elements of searchString converted to a String is the\nsame as the corresponding elements of this object (converted to a String) starting at\nendPosition – length(this). Otherwise returns false."},{"name":"normalize","type":"string","optional":false,"description":"Returns the String value result of normalizing the string into the normalization form\nnamed by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms."},{"name":"repeat","type":"string","optional":false,"description":"Returns a String value that is made from count copies appended together. If count is 0,\nthe empty string is returned."},{"name":"startsWith","type":"boolean","optional":false,"description":"Returns true if the sequence of elements of searchString converted to a String is the\nsame as the corresponding elements of this object (converted to a String) starting at\nposition. Otherwise returns false."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"anchor","type":"string","optional":false,"description":"Returns an `<a>` HTML anchor element and sets the name attribute to the text value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"big","type":"string","optional":false,"description":"Returns a `<big>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"blink","type":"string","optional":false,"description":"Returns a `<blink>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"bold","type":"string","optional":false,"description":"Returns a `<b>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"fixed","type":"string","optional":false,"description":"Returns a `<tt>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"fontcolor","type":"string","optional":false,"description":"Returns a `<font>` HTML element and sets the color attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility A legacy feature for browser compatibility","name":"fontsize","type":"string","optional":false,"description":"Returns a `<font>` HTML element and sets the size attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"italics","type":"string","optional":false,"description":"Returns an `<i>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"link","type":"string","optional":false,"description":"Returns an `<a>` HTML element and sets the href attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"small","type":"string","optional":false,"description":"Returns a `<small>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"strike","type":"string","optional":false,"description":"Returns a `<strike>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"sub","type":"string","optional":false,"description":"Returns a `<sub>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"sup","type":"string","optional":false,"description":"Returns a `<sup>` HTML element"},{"name":"padStart","type":"string","optional":false,"description":"Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.\nThe padding is applied from the start (left) of the current string."},{"name":"padEnd","type":"string","optional":false,"description":"Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.\nThe padding is applied from the end (right) of the current string."},{"name":"trimEnd","type":"string","optional":false,"description":"Removes the trailing white space and line terminator characters from a string."},{"name":"trimStart","type":"string","optional":false,"description":"Removes the leading white space and line terminator characters from a string."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility. Use `trimStart` instead","name":"trimLeft","type":"string","optional":false,"description":"Removes the leading white space and line terminator characters from a string."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility. Use `trimEnd` instead","name":"trimRight","type":"string","optional":false,"description":"Removes the trailing white space and line terminator characters from a string."},{"name":"matchAll","type":"RegExpStringIterator<RegExpExecArray>","optional":false,"description":"Matches a string with a regular expression, and returns an iterable of matches\ncontaining the results of that search."},{"name":"replaceAll","type":"string","optional":false,"description":"Replace all instances of a substring in a string, using a regular expression or search string."},{"name":"at","type":"string | undefined","optional":false,"description":"Returns a new String consisting of the single UTF-16 code unit located at the specified index."},{"name":"__@iterator@1879","type":"StringIterator<string>","optional":false,"description":"Iterator"}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"parseRouterHistoryState","id":"parse-router-history-state","label":"parseRouterHistoryState","category":"公共 API","categoryId":"api","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router/location","source":"packages/daisu-ui/src/router/location.ts","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"PasswordInput","id":"password-input","label":"PasswordInput 密码输入框","category":"录入","categoryId":"form","kind":"component","description":"密码输入框将内容分格显示,可与虚拟键盘组合录入验证码、支付密码等短内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/PasswordInput.tsx","docPath":"docs/ui/components/password-input.md","doc":"# PasswordInput 密码输入框\n\n密码输入框将内容分格显示,可与虚拟键盘组合录入验证码、支付密码等短内容。\n\n```tsx\nimport { PasswordInput } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 密码格\n\n通过 `value` 设置已输入内容,字符按格显示。\n\n```tsx\n<PasswordInput value=\"123\" />\n```\n\n## 组合用法\n\n### 配合虚拟键盘\n\n通过 `onFocus` 打开虚拟键盘,键盘的 `value` 和 `onChange` 与密码格共享输入内容。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Keyboard } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<PasswordInput\n value={value}\n onFocus={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 受控展示值,超出 length 的字符不展示,不修改调用方数据 | `string` | `''` |\n| mask | 用10px圆点隐藏字符;false展示明文 | `boolean` | `true` |\n| info | 底部提示;错误优先,错误清空后恢复普通提示 | `string` | `''` |\n| errorInfo | 底部提示;错误优先,错误清空后恢复普通提示 | `string` | `''` |\n| gutter | 数字/数字字符串按px;支持px/rem/em/vw/vh/%和rpx(750设计单位换算vw) | `number \\| string` | `0` |\n| length | 格子数量;小数取整、负数归零、NaN/Infinity回落6;最多1000,避免异常分配 | `number` | `6` |\n| focused | 当前值之后的空格显示1s闪烁光标,满位无光标;通常绑定Keyboard显隐 | `boolean` | `true` |\n| disabled | 禁止触发聚焦、隐藏光标;未显式传入时继承FormItem禁用 | `boolean` | — |\n| className | 根容器样式 | `string` | `''` |\n| style | 根容器样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onFocus | 获得焦点时触发 | (event: CommonEvent) => void |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[PasswordInput 组件源码](./sources/password-input/PasswordInput.tsx.txt) · [示例源码](./sources/password-input/demo.tsx.txt) · [文档源码](./sources/password-input/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Keyboard, PasswordInput } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function PasswordInputExample() {\n const [values, setValues] = useState(['123', '12', '123', '123', '123', '12']);\n const [active, setActive] = useState(-1);\n const example = (index: number, title: string) => <ExampleBlock title={title} noPadding>\n <PasswordInput value={values[index]} length={index === 1 ? 4 : 6} gutter={index === 2 ? 10 : 0} mask={index !== 3} focused={active === index}\n info={index === 4 ? '密码为 6 位数字' : ''} errorInfo={index === 4 && values[4]!.length === 6 && values[4] !== '123456' ? '密码错误' : ''}\n onFocus={() => { 'background only'; setActive(index); }} />\n </ExampleBlock>;\n return <view className=\"demo-password-input-page\">\n <DemoGroup title=\"组件类型\">{example(0, '基本用法')}</DemoGroup>\n <DemoGroup title=\"组件变体\">{example(1, '自定义长度')}</DemoGroup>\n <DemoGroup title=\"组件样式\">{example(2, '格子间距')}</DemoGroup>\n <DemoGroup title=\"内容形态\">{example(3, '明文展示')}{example(4, '提示信息')}</DemoGroup>\n <DemoGroup title=\"特殊用法\">{example(5, '随机键盘')}</DemoGroup>\n <Keyboard visible={active >= 0} onVisibleChange={visible => { 'background only'; if (!visible) setActive(-1); }} value={values[active] ?? ''}\n onChange={value => { 'background only'; setValues(previous => previous.map((entry, index) => index === active ? value : entry)); }}\n maxlength={active === 1 ? 4 : 6} randomKeyOrder={active === 5} />\n </view>;\n}\n","props":[{"name":"value","type":"string","optional":true,"description":"受控展示值,超出 length 的字符不展示,不修改调用方数据","defaultValue":"''"},{"name":"mask","type":"boolean","optional":true,"description":"用10px圆点隐藏字符;false展示明文","defaultValue":"true","values":[false,true]},{"name":"info","type":"string","optional":true,"description":"底部提示;错误优先,错误清空后恢复普通提示","defaultValue":"''"},{"name":"errorInfo","type":"string","optional":true,"description":"底部提示;错误优先,错误清空后恢复普通提示","defaultValue":"''"},{"name":"gutter","type":"number | string","optional":true,"description":"数字/数字字符串按px;支持px/rem/em/vw/vh/%和rpx(750设计单位换算vw)","defaultValue":"0"},{"name":"length","type":"number","optional":true,"description":"格子数量;小数取整、负数归零、NaN/Infinity回落6;最多1000,避免异常分配","defaultValue":"6"},{"name":"focused","type":"boolean","optional":true,"description":"当前值之后的空格显示1s闪烁光标,满位无光标;通常绑定Keyboard显隐","defaultValue":"true","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"禁止触发聚焦、隐藏光标;未显式传入时继承FormItem禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根容器样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根容器样式"}],"events":[{"name":"onFocus","type":"(event: CommonEvent) => void","optional":true,"description":"获得焦点时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","密码格"],"title":"密码格","section":"组件类型","description":"通过 `value` 设置已输入内容,字符按格显示。","language":"tsx","code":"<PasswordInput value=\"123\" />\n","blocks":[{"language":"tsx","code":"<PasswordInput value=\"123\" />\n"}]},{"name":"demo-2","aliases":["demo-2","配合虚拟键盘"],"title":"配合虚拟键盘","section":"组合用法","description":"通过 `onFocus` 打开虚拟键盘,键盘的 `value` 和 `onChange` 与密码格共享输入内容。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Keyboard } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<PasswordInput\n value={value}\n onFocus={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Keyboard } from 'daisu-ui';\n\nconst [value, setValue] = useState('');\n\nconst [visible, setVisible] = useState(false);\n\n<PasswordInput\n value={value}\n onFocus={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Keyboard\n value={value}\n onChange={setValue}\n visible={visible}\n onVisibleChange={setVisible}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Picker","id":"picker","label":"Picker 选择器","category":"录入","categoryId":"form","kind":"component","description":"选择器以弹层方式展示滚轮选项,支持多列、联动、确认和取消。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Picker.tsx","docPath":"docs/ui/components/picker.md","doc":"# Picker 选择器\n\n选择器以弹层方式展示滚轮选项,支持多列、联动、确认和取消。\n\n```tsx\nimport { Picker } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 打开选择器\n\n通过 `columns` 配置选项,`visible` 控制显示,`onConfirm` 返回确认后的选择。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择城市\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Picker\n visible={visible}\n onVisibleChange={setVisible}\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件样式\n\n### 自定义标题\n\n通过 `title` 设置标题,通过 `confirmButtonText` 设置确认按钮文案。\n\n```tsx\n<Picker\n visible={false}\n title=\"请选择城市\"\n confirmButtonText=\"确定\"\n columns={[{ value: 'sh', label: '上海' }]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| valueKey | 选项值字段名 | `string` | — |\n| labelKey | 显示文案字段名 | `string` | — |\n| childrenKey | 子节点字段名 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `readonly PickerValue[]` | — |\n| columns | 列或选项配置 | `PickerColumns` | 必填 |\n| cascade | 是否联动后续选项列 | `boolean` | — |\n| itemHeight | 数据项高度 | `number` | — |\n| visibleItemCount | 滚轮可见行数 | `number` | — |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| visible | 是否显示选择面板 | `boolean` | — |\n| title | 标题内容 | `ReactNode` | `''` |\n| confirmButtonText | 确认按钮文案 | `string` | `'完成'` |\n| cancelButtonText | 取消按钮文案 | `string` | `'取消'` |\n| beforeConfirm | 确认前校验 | `(value: PickerValue[]) => boolean \\| Promise<boolean>` | — |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `true` |\n| viewClassName | 选择面板类名 | `string` | — |\n| zIndex | 浮层层级 | `number` | `100` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: PickerChange) => void |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n| onVisibleChange | 面板显示状态变化时触发 | (visible: boolean) => void |\n| onConfirm | 确认选择时触发 | (event: PickerChange) => void |\n| onCancel | 取消操作时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n| onOpen | 打开时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | 标题内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type PickerValue = string | number;\n\nexport type PickerColumns =\n | readonly PickerColumnItem[]\n | readonly (readonly PickerColumnItem[])[];\n\nexport type PickerChange = {\n value: PickerValue[];\n selectedItems: PickerOption[];\n selectedValues: PickerValue[];\n selectedOptions: PickerOption[];\n selectedLabels: string[];\n selectedIndexes: number[];\n columnIndex: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-picker-fade-bottom` | 当前组件 |\n| `--cso-ui-picker-fade-top` | 当前组件 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Picker 组件源码](./sources/picker/Picker.tsx.txt) · [示例源码](./sources/picker/demo.tsx.txt) · [文档源码](./sources/picker/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Cell, CellGroup, Picker, Toast, useToast } from 'daisu-ui';\nimport type { PickerValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { pickerOptions, pickerUniversity, pickerAreas } from './pickerShared.js';\nconst longOptions = pickerOptions.map((item, index) => index === 0 ? { value: '选项1'.repeat(13), label: '选项1'.repeat(13) } : item);\nconst initial: Record<string, PickerValue[]> = { basic: [], multiple: [], area: ['110000', '110100', '110102'], title: ['选项1'], large: ['选项3'], right: ['选项3'], separator: ['中南大学', '软件工程'], validate: [] };\nexport function PickerExample() {\n const [values, setValues] = useState(initial), [opened, setOpened] = useState(''), [labels, setLabels] = useState<Record<string, string>>({ area: '北京 - 北京 - 西城区', separator: '中南大学-软件工程' });\n const toast = useToast(), pending = useRef<{ timer: ReturnType<typeof setTimeout>; resolve: (allow: boolean) => void }>();\n useEffect(() => () => { if (pending.current) { clearTimeout(pending.current.timer); pending.current.resolve(false); } }, []);\n const beforeConfirm = (value: PickerValue[]) => {\n 'background only'; toast.loading({ msg: '处理中', zIndex: 110 });\n return new Promise<boolean>(resolve => { const timer = setTimeout(() => { pending.current = undefined; toast.close(); const allowed = !['选项2', '选项3'].includes(String(value[0])); if (!allowed) toast.error({ msg: '选项校验不通过,请重新选择', zIndex: 110 }); resolve(allowed); }, 2000); pending.current = { timer, resolve }; });\n };\n const example = (key: string, heading: string, cellTitle = heading) => {\n const columns = key === 'area' ? pickerAreas : key === 'multiple' || key === 'separator' ? pickerUniversity : key === 'title' ? pickerOptions : longOptions;\n return <ExampleBlock key={key} title={heading} noPadding><CellGroup border><Cell title={cellTitle} value={labels[key] ?? String(values[key]?.[0] ?? '')} placeholder={key === 'basic' ? '请选择' : undefined} size={key === 'large' ? 'large' : 'medium'} arrow ellipsis onTap={() => setOpened(key)} /></CellGroup>\n <Picker visible={opened === key} onVisibleChange={show => { 'background only'; if (!show) { setOpened(''); if (pending.current) { clearTimeout(pending.current.timer); pending.current.resolve(false); pending.current = undefined; toast.close(); } } }} value={values[key]} columns={columns} cascade={key === 'area'} title={key === 'title' ? '文案标题' : ''} beforeConfirm={key === 'validate' ? beforeConfirm : undefined} onConfirm={({ value, selectedLabels }) => {\n 'background only'; setValues(previous => ({ ...previous, [key]: value }));\n if (['multiple', 'area', 'separator'].includes(key)) setLabels(previous => ({ ...previous, [key]: selectedLabels.join(key === 'multiple' ? ', ' : key === 'area' ? ' - ' : '-') }));\n }} />\n </ExampleBlock>;\n };\n return <view className=\"demo-picker-page\">\n <DemoGroup title=\"基础用法\">{example('basic', '单列选项')}{example('multiple', '多列')}{example('area', '多级联动')}</DemoGroup>\n <DemoGroup title=\"内容形态\">{example('title', '文案标题', '标题')}</DemoGroup>\n <DemoGroup title=\"组件样式\">{example('large', '大小', '单列选项')}{example('right', '值靠右显示', '单列选项')}</DemoGroup>\n <DemoGroup title=\"特殊交互\">{example('separator', '分隔符')}{example('validate', '确定前校验', 'before-confirm')}</DemoGroup>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"valueKey","type":"string","optional":true,"description":"选项值字段名"},{"name":"labelKey","type":"string","optional":true,"description":"显示文案字段名"},{"name":"childrenKey","type":"string","optional":true,"description":"子节点字段名"},{"name":"value","type":"readonly PickerValue[]","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"columns","type":"PickerColumns","optional":false,"description":"列或选项配置","defaultValue":"必填"},{"name":"cascade","type":"boolean","optional":true,"description":"是否联动后续选项列","values":[false,true]},{"name":"itemHeight","type":"number","optional":true,"description":"数据项高度"},{"name":"visibleItemCount","type":"number","optional":true,"description":"滚轮可见行数"},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"visible","type":"boolean","optional":true,"description":"是否显示选择面板","values":[false,true]},{"name":"title","type":"ReactNode","optional":true,"description":"标题内容","defaultValue":"''"},{"name":"confirmButtonText","type":"string","optional":true,"description":"确认按钮文案","defaultValue":"'完成'"},{"name":"cancelButtonText","type":"string","optional":true,"description":"取消按钮文案","defaultValue":"'取消'"},{"name":"beforeConfirm","type":"(value: PickerValue[]) => boolean | Promise<boolean>","optional":true,"description":"确认前校验"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"true","values":[false,true]},{"name":"viewClassName","type":"string","optional":true,"description":"选择面板类名"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"100"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"}],"events":[{"name":"onChange","type":"(event: PickerChange) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"面板显示状态变化时触发"},{"name":"onConfirm","type":"(event: PickerChange) => void","optional":true,"description":"确认选择时触发"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消操作时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"}],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容","defaultValue":"''"}],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-picker-fade-bottom","defaultValue":"linear-gradient(180deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-picker-fade-top","defaultValue":"linear-gradient(0deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","打开选择器"],"title":"打开选择器","section":"组件类型","description":"通过 `columns` 配置选项,`visible` 控制显示,`onConfirm` 返回确认后的选择。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择城市\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Picker\n visible={visible}\n onVisibleChange={setVisible}\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择城市\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<Picker\n visible={visible}\n onVisibleChange={setVisible}\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onConfirm={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义标题"],"title":"自定义标题","section":"组件样式","description":"通过 `title` 设置标题,通过 `confirmButtonText` 设置确认按钮文案。","language":"tsx","code":"<Picker\n visible={false}\n title=\"请选择城市\"\n confirmButtonText=\"确定\"\n columns={[{ value: 'sh', label: '上海' }]}\n/>\n","blocks":[{"language":"tsx","code":"<Picker\n visible={false}\n title=\"请选择城市\"\n confirmButtonText=\"确定\"\n columns={[{ value: 'sh', label: '上海' }]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"PickerView","id":"picker-view","label":"PickerView 选择器视图","category":"录入","categoryId":"form","kind":"component","description":"选择器视图将滚轮面板直接嵌入页面,适合自定义弹层或固定区域选择。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/PickerView.tsx","docPath":"docs/ui/components/picker-view.md","doc":"# PickerView 选择器视图\n\n选择器视图将滚轮面板直接嵌入页面,适合自定义弹层或固定区域选择。\n\n```tsx\nimport { PickerView } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 单列选择\n\n通过 `columns` 配置选项,通过 `onChange` 获取滚轮选择结果。\n\n```tsx\n<PickerView\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n```\n\n## 组件样式\n\n### 滚轮高度\n\n通过 `visibleItemCount` 设置可见选项的行数。\n\n```tsx\n<PickerView\n visibleItemCount={5}\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| valueKey | 选项值字段名 | `string` | — |\n| labelKey | 显示文案字段名 | `string` | — |\n| childrenKey | 子节点字段名 | `string` | — |\n| value | 当前值;传入后由调用方更新 | `readonly PickerValue[]` | — |\n| columns | 列或选项配置 | `PickerColumns` | 必填 |\n| cascade | 是否联动后续选项列 | `boolean` | `false` |\n| itemHeight | 数据项高度 | `number` | `44` |\n| visibleItemCount | 滚轮可见行数 | `number` | `6` |\n| immediateChange | 输入时是否立即触发变化 | `boolean` | `false` |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: PickerChange) => void |\n| onPickStart | 对应操作发生时触发 | () => void |\n| onPickEnd | 对应操作发生时触发 | () => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| getSelected | 调用实例方法 | () => PickerChange |\n| getSelectedOptions | 调用实例方法 | () => PickerOption[] |\n| getSelectedValues | 调用实例方法 | () => PickerValue[] |\n| getSelectedLabels | 调用实例方法 | () => string[] |\n| getSelectedIndex | 调用实例方法 | () => number[] |\n| getColumnsData | 调用实例方法 | () => readonly (readonly PickerOption[])[] |\n| getColumnData | 调用实例方法 | (index: number) => readonly PickerOption[] |\n| getColumnIndex | 调用实例方法 | (index: number) => number |\n| resetColumns | 调用实例方法 | (columns: PickerColumns) => void |\n\n## 数据类型\n\n```tsx\nexport type PickerValue = string | number;\n\nexport type PickerColumns =\n | readonly PickerColumnItem[]\n | readonly (readonly PickerColumnItem[])[];\n\nexport type PickerChange = {\n value: PickerValue[];\n selectedItems: PickerOption[];\n selectedValues: PickerValue[];\n selectedOptions: PickerOption[];\n selectedLabels: string[];\n selectedIndexes: number[];\n columnIndex: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[PickerView 组件源码](./sources/picker-view/PickerView.tsx.txt) · [示例源码](./sources/picker-view/demo.tsx.txt) · [文档源码](./sources/picker-view/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { PickerView } from 'daisu-ui';\nimport type { PickerValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { pickerOptions, pickerDisabledOptions, pickerUniversity, pickerAreas } from './pickerShared.js';\nconst custom = [{ id: 1, text: '选项一' }, { id: 2, text: '选项二' }, { id: 3, text: '选项三' }];\nexport function PickerViewExample() {\n const [basic, setBasic] = useState<PickerValue[]>([]), [disabled, setDisabled] = useState<PickerValue[]>([]), [immediate, setImmediate] = useState<PickerValue[]>([]);\n const [multiple, setMultiple] = useState<PickerValue[]>(['中南大学', '软件工程']), [area, setArea] = useState<PickerValue[]>(['110000', '110100', '110102']), [fields, setFields] = useState<PickerValue[]>([1]), [message, setMessage] = useState('');\n const [reports, setReports] = useState<Record<string, string>>({});\n const result = (key: string) => <text className=\"demo-picker-view-result\">{`当前值:${reports[key] ?? ''}`}</text>;\n const report = (key: string, values: PickerValue[]) => setReports(previous => ({ ...previous, [key]: values.join(' / ') }));\n return <view className=\"demo-picker-view-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\" noPadding>{result('basic')}<PickerView value={basic} columns={pickerOptions} onChange={({ value }) => { setBasic(value); report('basic', value); }} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用选项\" noPadding>{result('disabled')}<PickerView value={disabled} columns={pickerDisabledOptions} onChange={({ value }) => { setDisabled(value); report('disabled', value); }} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"立即触发\" noPadding>{result('immediate')}<text className=\"demo-picker-view-result\">{`变更信息:${message}`}</text><PickerView value={immediate} columns={pickerDisabledOptions} immediateChange onChange={({ value, selectedLabels, columnIndex }) => { 'background only'; setImmediate(value); report('immediate', value); setMessage(`${selectedLabels.join(' / ')},第 ${columnIndex} 列`); }} /></ExampleBlock>\n <ExampleBlock title=\"多列\" noPadding>{result('multiple')}<PickerView value={multiple} columns={pickerUniversity} onChange={({ value }) => { setMultiple(value); report('multiple', value); }} /></ExampleBlock>\n <ExampleBlock title=\"多级联动\" noPadding>{result('area')}<PickerView value={area} columns={pickerAreas} cascade onChange={({ value }) => { setArea(value); report('area', value); }} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"自定义字段\" noPadding>{result('fields')}<PickerView value={fields} columns={custom} valueKey=\"id\" labelKey=\"text\" onChange={({ value }) => { setFields(value); report('fields', value); }} /></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"valueKey","type":"string","optional":true,"description":"选项值字段名"},{"name":"labelKey","type":"string","optional":true,"description":"显示文案字段名"},{"name":"childrenKey","type":"string","optional":true,"description":"子节点字段名"},{"name":"value","type":"readonly PickerValue[]","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"columns","type":"PickerColumns","optional":false,"description":"列或选项配置","defaultValue":"必填"},{"name":"cascade","type":"boolean","optional":true,"description":"是否联动后续选项列","defaultValue":"false","values":[false,true]},{"name":"itemHeight","type":"number","optional":true,"description":"数据项高度","defaultValue":"44"},{"name":"visibleItemCount","type":"number","optional":true,"description":"滚轮可见行数","defaultValue":"6"},{"name":"immediateChange","type":"boolean","optional":true,"description":"输入时是否立即触发变化","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: PickerChange) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPickStart","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onPickEnd","type":"() => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"getSelected","description":"调用实例方法","type":"() => PickerChange"},{"name":"getSelectedOptions","description":"调用实例方法","type":"() => PickerOption[]"},{"name":"getSelectedValues","description":"调用实例方法","type":"() => PickerValue[]"},{"name":"getSelectedLabels","description":"调用实例方法","type":"() => string[]"},{"name":"getSelectedIndex","description":"调用实例方法","type":"() => number[]"},{"name":"getColumnsData","description":"调用实例方法","type":"() => readonly (readonly PickerOption[])[]"},{"name":"getColumnData","description":"调用实例方法","type":"(index: number) => readonly PickerOption[]"},{"name":"getColumnIndex","description":"调用实例方法","type":"(index: number) => number"},{"name":"resetColumns","description":"调用实例方法","type":"(columns: PickerColumns) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","单列选择"],"title":"单列选择","section":"组件类型","description":"通过 `columns` 配置选项,通过 `onChange` 获取滚轮选择结果。","language":"tsx","code":"<PickerView\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<PickerView\n columns={[\n { value: 'sh', label: '上海' },\n { value: 'bj', label: '北京' },\n ]}\n onChange={(event) => {\n 'background only';\n console.log(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","滚轮高度"],"title":"滚轮高度","section":"组件样式","description":"通过 `visibleItemCount` 设置可见选项的行数。","language":"tsx","code":"<PickerView\n visibleItemCount={5}\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<PickerView\n visibleItemCount={5}\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Popover","id":"popover","label":"Popover 气泡","category":"反馈","categoryId":"feedback","kind":"component","description":"气泡用于在触发元素附近展示辅助内容或菜单,支持方向、箭头和自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Popover.tsx","docPath":"docs/ui/components/popover.md","doc":"# Popover 气泡\n\n气泡用于在触发元素附近展示辅助内容或菜单,支持方向、箭头和自定义内容。\n\n```tsx\nimport { Popover } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 文字气泡\n\n通过 `content` 设置气泡文字,子节点作为触发元素。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Popover content=\"这里是提示内容\">\n <Button label=\"显示气泡\" />\n</Popover>\n```\n\n## 组件样式\n\n### 指定方向\n\n通过 `placement` 设置气泡相对触发元素的位置。\n\n```tsx\n<Popover content=\"显示在上方\" placement=\"top\">\n <Button label=\"上方气泡\" />\n</Popover>\n```\n\n## 内容形态\n\n### 自定义内容\n\n通过 `contentNode` 传入自定义内容节点。\n\n```tsx\n<Popover contentNode={<text>自定义气泡内容</text>}>\n <Button label=\"查看内容\" />\n</Popover>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| zIndex | 浮层层级 | `number` | — |\n| offset | 相对目标元素的偏移 | `BubbleOffset` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| show | 是否显示 | `boolean` | — |\n| defaultShow | 非受控模式的初始显示状态 | `boolean` | — |\n| placement | 浮层相对触发元素的位置 | `BubblePlacement` | — |\n| visibleArrow | 是否显示气泡箭头 | `boolean` | — |\n| showClose | 是否显示关闭按钮 | `boolean` | — |\n| duration | 动画或显示时长,单位 ms | `number` | — |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | — |\n| arrowClassName | 气泡箭头类名 | `string` | — |\n| popClassName | 气泡面板类名 | `string` | — |\n| popStyle | 气泡面板样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| contentNode | contentNode 配置 | `ReactNode` | — |\n| content | 内容 | `string \\| readonly PopoverMenuItem[]` | `''` |\n| mode | 展示或格式化模式 | `'normal' \\| 'menu'` | `'normal'` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { show: boolean }) => void |\n| onShowChange | 显示状态变化时触发 | (show: boolean) => void |\n| onOpen | 打开时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n| onMenuClick | 对应操作发生时触发 | (event: { item: PopoverMenuItem; index: number }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n| contentNode | 自定义区域内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n| updatePosition | 重新计算位置 | () => void |\n\n## 数据类型\n\n```tsx\nexport type BubbleOffset =\n | number\n | readonly number[]\n | { x: number; y: number };\n\nexport type BubblePlacement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end';\n\nexport type PopoverMenuItem = {\n content: string;\n iconClass?: string;\n [key: string]: unknown;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Popover 组件源码](./sources/popover/Popover.tsx.txt) · [示例源码](./sources/popover/demo.tsx.txt) · [文档源码](./sources/popover/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Button, Popover, RadioGroup, Toast, useToast } from 'daisu-ui';\nimport type { BubblePlacement, PopoverMenuItem, PopoverRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst placements: BubblePlacement[] = ['bottom', 'bottom-start', 'bottom-end', 'top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'];\nconst placementOptions = placements.map(value => ({ label: value, value }));\nconst menu: PopoverMenuItem[] = [{ iconClass: 'check', content: '全部标记已读' }, { iconClass: 'delete', content: '清空最近会话' }, { iconClass: 'subscribe', content: '消息订阅设置' }, { iconClass: 'scan', content: '消息异常检测' }];\n\nexport function PopoverExample() {\n const refs = useRef<Record<string, PopoverRef | null>>({});\n const [placement, setPlacement] = useState<BubblePlacement>('bottom');\n const [width, setWidth] = useState(150);\n const toast = useToast();\n const closeAll = (except?: string) => { 'background only'; for (const [key, value] of Object.entries(refs.current)) if (key !== except) value?.close(); };\n const props = (key: string) => ({ ref: (value: PopoverRef | null) => { 'background only'; refs.current[key] = value; }, onOpen: () => closeAll(key), placement });\n return <view className=\"demo-popover-page\" bindtap={() => closeAll()}>\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><view className=\"demo-popover-trigger\"><Popover {...props('basic')} content=\"这是一段内容。\"><Button label=\"点击展示\" /></Popover></view></ExampleBlock>\n <ExampleBlock title=\"列表展示\"><view className=\"demo-popover-trigger\"><Popover {...props('menu')} mode=\"menu\" content={menu} onMenuClick={({ item }) => toast.show('选择了' + item.content)}><Button label=\"列表\" /></Popover></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"位置\"><view className=\"demo-popover-options\"><RadioGroup value={placement} options={placementOptions} onChange={value => setPlacement(value as BubblePlacement)} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"嵌套信息\"><view className=\"demo-popover-trigger\"><Popover {...props('custom')} contentNode={<view className=\"demo-popover-custom\"><text>这是一段自定义样式的内容。</text></view>}><Button label=\"点击展示\" /></Popover></view></ExampleBlock>\n <ExampleBlock title=\"显示关闭按钮\"><view className=\"demo-popover-trigger\"><Popover {...props('closable')} content=\"这是一段内容。\" showClose><Button label=\"显示关闭按钮\" /></Popover></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"动态内容与位置更新\"><view className=\"demo-popover-trigger\"><Popover {...props('dynamic')} contentNode={<view className=\"demo-popover-custom\" style={{ width: `${width}px` }}><text className=\"demo-popover-status\">当前宽度:{width}px</text><Button label=\"改变大小并更新\" size=\"small\" onTap={() => { 'background only'; setWidth(value => value === 150 ? 250 : 150); refs.current.dynamic?.updatePosition(); }} /></view>}><Button label=\"动态内容\" /></Popover></view></ExampleBlock></DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"offset","type":"BubbleOffset","optional":true,"description":"相对目标元素的偏移"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms"},{"name":"show","type":"boolean","optional":true,"description":"是否显示","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","values":[false,true]},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"defaultShow","type":"boolean","optional":true,"description":"非受控模式的初始显示状态","values":[false,true]},{"name":"placement","type":"BubblePlacement","optional":true,"description":"浮层相对触发元素的位置","values":["bottom","left","right","top","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"]},{"name":"visibleArrow","type":"boolean","optional":true,"description":"是否显示气泡箭头","values":[false,true]},{"name":"showClose","type":"boolean","optional":true,"description":"是否显示关闭按钮","values":[false,true]},{"name":"arrowClassName","type":"string","optional":true,"description":"气泡箭头类名"},{"name":"popClassName","type":"string","optional":true,"description":"气泡面板类名"},{"name":"popStyle","type":"CSSProperties","optional":true,"description":"气泡面板样式"},{"name":"contentNode","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"content","type":"string | readonly PopoverMenuItem[]","optional":true,"description":"内容","defaultValue":"''"},{"name":"mode","type":"'normal' | 'menu'","optional":true,"description":"展示或格式化模式","defaultValue":"'normal'","values":["menu","normal"]}],"events":[{"name":"onChange","type":"(event: { show: boolean }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onShowChange","type":"(show: boolean) => void","optional":true,"description":"显示状态变化时触发"},{"name":"onMenuClick","type":"(event: { item: PopoverMenuItem; index: number }) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"},{"name":"contentNode","type":"ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"},{"name":"updatePosition","description":"重新计算位置","type":"() => void"}],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","文字气泡"],"title":"文字气泡","section":"组件类型","description":"通过 `content` 设置气泡文字,子节点作为触发元素。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Popover content=\"这里是提示内容\">\n <Button label=\"显示气泡\" />\n</Popover>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Popover content=\"这里是提示内容\">\n <Button label=\"显示气泡\" />\n</Popover>\n"}]},{"name":"demo-2","aliases":["demo-2","指定方向"],"title":"指定方向","section":"组件样式","description":"通过 `placement` 设置气泡相对触发元素的位置。","language":"tsx","code":"<Popover content=\"显示在上方\" placement=\"top\">\n <Button label=\"上方气泡\" />\n</Popover>\n","blocks":[{"language":"tsx","code":"<Popover content=\"显示在上方\" placement=\"top\">\n <Button label=\"上方气泡\" />\n</Popover>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义内容"],"title":"自定义内容","section":"内容形态","description":"通过 `contentNode` 传入自定义内容节点。","language":"tsx","code":"<Popover contentNode={<text>自定义气泡内容</text>}>\n <Button label=\"查看内容\" />\n</Popover>\n","blocks":[{"language":"tsx","code":"<Popover contentNode={<text>自定义气泡内容</text>}>\n <Button label=\"查看内容\" />\n</Popover>\n"}]}],"allowUnknownProps":false},{"name":"Popup","id":"popup","label":"Popup 弹出层","category":"反馈","categoryId":"feedback","kind":"component","description":"弹出层用于展示临时操作或内容,支持多个弹出方向、遮罩、圆角和关闭按钮。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Popup.tsx","docPath":"docs/ui/components/popup.md","doc":"# Popup 弹出层\n\n弹出层用于展示临时操作或内容,支持多个弹出方向、遮罩、圆角和关闭按钮。\n\n```tsx\nimport { Popup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础弹层\n\n通过 `show` 和 `onChange` 控制显示状态,设置 `closable` 显示关闭按钮。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开弹层\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup show={show} onChange={setShow} closable>\n <text>弹层内容</text>\n</Popup>\n```\n\n## 布局能力\n\n### 底部弹出\n\n设置 `position=\"bottom\"` 从底部弹出,配合 `round` 和 `safeAreaInsetBottom` 使用圆角及底部安全区。\n\n```tsx\n<Popup show={false} position=\"bottom\" round safeAreaInsetBottom>\n <text>底部内容</text>\n</Popup>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| show | 受控值 / 请求更新;关闭时回调 false | `boolean` | `false` |\n| position | center/top/right/bottom/left | `PopupPosition` | `'center'` |\n| transition | 居中 fade+zoom-in,其余对应方向 slide;可传名称数组 | `TransitionName \\| readonly TransitionName[]` | — |\n| duration | 毫秒或boolean | `number \\| boolean` | `300` |\n| closable | 关闭按钮 | `boolean` | `false` |\n| closeOnClickModal | 遮罩点击关闭 / 展示遮罩 | `boolean` | `true` |\n| modal | 遮罩点击关闭 / 展示遮罩 | `boolean` | `true` |\n| modalStyle | 遮罩 CSSProperties | `CSSProperties` | — |\n| zIndex | 遮罩层级,面板使用 zIndex+1 | `number` | `10` |\n| lazyRender | 第一次显示时挂载;后续保留并隐藏,保存表单状态 | `boolean` | `true` |\n| lockScroll | 对触摸链拦截滑动,边界同 Overlay | `boolean` | `true` |\n| rootPortal | 原生 RootPortal,需要根 Host | `boolean` | `false` |\n| round | 按弹出方向设置圆角 | `boolean` | `false` |\n| safeAreaInsetBottom | 底部插入宿主提供的安全区高度,单位px | `boolean` | `false` |\n| safeAreaBottom | 底部插入宿主提供的安全区高度,单位px | `number` | `0` |\n| className | 面板样式、内容;根 Host 外层局部主题需自行传入类名 | `string` | `''` |\n| style | 面板样式、内容;根 Host 外层局部主题需自行传入类名 | `CSSProperties` | — |\n| children | 面板样式、内容;根 Host 外层局部主题需自行传入类名 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onBeforeEnter | 进入生命周期 | () => void |\n| onEnter | 进入生命周期 | () => void |\n| onAfterEnter | 进入生命周期 | () => void |\n| onBeforeLeave | 离开生命周期 | () => void |\n| onLeave | 离开生命周期 | () => void |\n| onAfterLeave | 离开生命周期 | () => void |\n| onChange | 受控值 / 请求更新;关闭时回调 false | (show: boolean) => void |\n| onClose | 请求关闭,reason: modal/close | (reason: PopupCloseReason) => void |\n| onClickModal | 遮罩点击,禁用自动关闭时仍触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 面板样式、内容;根 Host 外层局部主题需自行传入类名 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type PopupCloseReason = 'modal' | 'close';\n\nexport type PopupPosition = 'center' | 'top' | 'right' | 'bottom' | 'left';\n\nexport type TransitionName =\n | 'fade'\n | 'fade-up'\n | 'fade-down'\n | 'fade-left'\n | 'fade-right'\n | 'slide-up'\n | 'slide-down'\n | 'slide-left'\n | 'slide-right'\n | 'zoom-in'\n | 'zoom-out';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Popup 组件源码](./sources/popup/Popup.tsx.txt) · [示例源码](./sources/popup/demo.tsx.txt) · [文档源码](./sources/popup/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, Popup } from 'daisu-ui';\nimport type { PopupPosition } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\ntype Example = 'center' | 'top' | 'right' | 'bottom' | 'left' | 'close' | 'no-click' | 'no-modal' | 'safe' | 'scroll' | 'parent';\nexport function PopupExample() {\n const [active, setActive] = useState<Example>('center');\n const [shown, setShown] = useState(false);\n const [child, setChild] = useState(false);\n const open = (value: Example) => () => { 'background only'; setActive(value); setShown(true); };\n const cell = (title: string, value: Example) => <Cell title={title} arrow onTap={open(value)} />;\n const position: PopupPosition = active && ['top', 'right', 'bottom', 'left'].includes(active) ? active as PopupPosition : active === 'center' || active === 'parent' ? 'center' : 'bottom';\n return <view className=\"demo-popup-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\" noPadding><CellGroup>{cell('弹出层', 'center')}</CellGroup></ExampleBlock>\n <ExampleBlock title=\"弹出位置\" noPadding><CellGroup border>{cell('顶部', 'top')}{cell('右侧', 'right')}{cell('底部', 'bottom')}{cell('左侧', 'left')}</CellGroup></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"关闭按钮\" noPadding>{cell('关闭按钮', 'close')}</ExampleBlock>\n <ExampleBlock title=\"禁用遮罩点击\" noPadding>{cell('禁用遮罩点击', 'no-click')}</ExampleBlock>\n <ExampleBlock title=\"禁用遮罩\" noPadding>{cell('禁用遮罩', 'no-modal')}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"开启底部安全区\" noPadding>{cell('开启底部安全区', 'safe')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"锁定滚动\" noPadding>{cell('锁定滚动', 'scroll')}</ExampleBlock>\n <ExampleBlock title=\"嵌套弹窗与 root-portal\" noPadding>{cell('嵌套弹窗测试', 'parent')}</ExampleBlock>\n </DemoGroup>\n {/* Separate position instances prevent a closing panel jumping to another edge. */}\n {(['center', 'top', 'right', 'bottom', 'left'] as const).map(edge => <Popup key={edge} show={shown && position === edge} rootPortal position={edge} className={`ui-demo-page demo-popup-panel ${edge === 'center' ? 'demo-popup-center' : ''}`} style={edge === 'center' ? { borderRadius: '4.266667vw' } : edge === 'left' || edge === 'right' ? { width: '200px' } : { height: '200px' }} closable={['close', 'no-click', 'no-modal'].includes(active ?? '')} closeOnClickModal={active !== 'no-click'} modal={active !== 'no-modal'} safeAreaInsetBottom={active === 'safe'} onChange={() => { setShown(false); setChild(false); }}>\n {edge === 'center' ? active === 'parent' ? <view className=\"demo-popup-parent\"><text>父弹窗</text><Button label=\"打开传送子弹窗\" size=\"small\" tone=\"success\" onTap={() => setChild(true)} /></view> : <view className=\"demo-popup-square\"><text>弹弹弹</text></view> : active === 'scroll' ? <view className=\"demo-popup-scroll\"><text>锁定滚动</text>{Array.from({ length: 10 }, (_, i) => <text key={i}>内容 {i + 1}</text>)}</view> : null}\n </Popup>)}\n <Popup show={child} rootPortal zIndex={20} round closable className=\"ui-demo-page\" style={{ padding: '24px', width: '280px' }} onChange={setChild}><text className=\"demo-popup-child-copy\">这个子弹窗会脱离父层级渲染</text></Popup>\n </view>;\n}\n","props":[{"name":"show","type":"boolean","optional":true,"description":"受控值 / 请求更新;关闭时回调 false","defaultValue":"false","values":[false,true]},{"name":"position","type":"PopupPosition","optional":true,"description":"center/top/right/bottom/left","defaultValue":"'center'","values":["bottom","left","right","top","center"]},{"name":"transition","type":"TransitionName | readonly TransitionName[]","optional":true,"description":"居中 fade+zoom-in,其余对应方向 slide;可传名称数组"},{"name":"duration","type":"number | boolean","optional":true,"description":"毫秒或boolean","defaultValue":"300"},{"name":"closable","type":"boolean","optional":true,"description":"关闭按钮","defaultValue":"false","values":[false,true]},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"遮罩点击关闭 / 展示遮罩","defaultValue":"true","values":[false,true]},{"name":"modal","type":"boolean","optional":true,"description":"遮罩点击关闭 / 展示遮罩","defaultValue":"true","values":[false,true]},{"name":"modalStyle","type":"CSSProperties","optional":true,"description":"遮罩 CSSProperties"},{"name":"zIndex","type":"number","optional":true,"description":"遮罩层级,面板使用 zIndex+1","defaultValue":"10"},{"name":"lazyRender","type":"boolean","optional":true,"description":"第一次显示时挂载;后续保留并隐藏,保存表单状态","defaultValue":"true","values":[false,true]},{"name":"lockScroll","type":"boolean","optional":true,"description":"对触摸链拦截滑动,边界同 Overlay","defaultValue":"true","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"原生 RootPortal,需要根 Host","defaultValue":"false","values":[false,true]},{"name":"round","type":"boolean","optional":true,"description":"按弹出方向设置圆角","defaultValue":"false","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"底部插入宿主提供的安全区高度,单位px","defaultValue":"false","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部插入宿主提供的安全区高度,单位px","defaultValue":"0"},{"name":"className","type":"string","optional":true,"description":"面板样式、内容;根 Host 外层局部主题需自行传入类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"面板样式、内容;根 Host 外层局部主题需自行传入类名"}],"events":[{"name":"onBeforeEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onAfterEnter","type":"() => void","optional":true,"description":"进入生命周期"},{"name":"onBeforeLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onAfterLeave","type":"() => void","optional":true,"description":"离开生命周期"},{"name":"onChange","type":"(show: boolean) => void","optional":true,"description":"受控值 / 请求更新;关闭时回调 false"},{"name":"onClose","type":"(reason: PopupCloseReason) => void","optional":true,"description":"请求关闭,reason: modal/close"},{"name":"onClickModal","type":"() => void","optional":true,"description":"遮罩点击,禁用自动关闭时仍触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"面板样式、内容;根 Host 外层局部主题需自行传入类名"}],"methods":[],"cssVars":[{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","基础弹层"],"title":"基础弹层","section":"组件类型","description":"通过 `show` 和 `onChange` 控制显示状态,设置 `closable` 显示关闭按钮。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开弹层\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup show={show} onChange={setShow} closable>\n <text>弹层内容</text>\n</Popup>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<Button\n label=\"打开弹层\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup show={show} onChange={setShow} closable>\n <text>弹层内容</text>\n</Popup>\n"}]},{"name":"demo-2","aliases":["demo-2","底部弹出"],"title":"底部弹出","section":"布局能力","description":"设置 `position=\"bottom\"` 从底部弹出,配合 `round` 和 `safeAreaInsetBottom` 使用圆角及底部安全区。","language":"tsx","code":"<Popup show={false} position=\"bottom\" round safeAreaInsetBottom>\n <text>底部内容</text>\n</Popup>\n","blocks":[{"language":"tsx","code":"<Popup show={false} position=\"bottom\" round safeAreaInsetBottom>\n <text>底部内容</text>\n</Popup>\n"}]}],"allowUnknownProps":false},{"name":"Progress","id":"progress","label":"Progress 进度条","category":"反馈","categoryId":"feedback","kind":"component","description":"进度条用于展示任务完成情况,支持文字位置、状态颜色和自定义进度样式。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Progress.tsx","docPath":"docs/ui/components/progress.md","doc":"# Progress 进度条\n\n进度条用于展示任务完成情况,支持文字位置、状态颜色和自定义进度样式。\n\n```tsx\nimport { Progress } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 显示进度\n\n通过 `percentage` 设置完成百分比。\n\n```tsx\n<Progress percentage={60} />\n```\n\n## 组件样式\n\n### 自定义颜色\n\n通过 `color` 设置进度条颜色。\n\n```tsx\n<Progress percentage={80} color=\"#12b886\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| percentage | 百分比;有限值裁剪至 0–100,NaN/Infinity 按 0 处理 | `number` | `0` |\n| hideText | 隐藏百分比;指定 status 时显示状态图标 | `boolean` | `false` |\n| color | 字符串、只读字符串数组或 `{ color, percentage }[]`,覆盖状态的进度条颜色 | `ProgressColor` | — |\n| status | success / danger / warning,使用公共 Icon 和语义颜色 | `'success' \\| 'danger' \\| 'warning'` | — |\n| duration | 每变化 1% 的毫秒数;0 立即更新,非法值回退 30 | `number` | `30` |\n| percentPosition | `{ type?: 'inner' \\| 'outer', align?: 'left' \\| 'center' \\| 'right' }`;align 用于内部文本 | `PercentPosition` | — |\n| className | 根节点样式;可用 style.height 调整组件高度,内部模式轨道占满高度 | `string` | `''` |\n| style | 根节点样式;可用 style.height 调整组件高度,内部模式轨道占满高度 | `CSSProperties` | — |\n\n## 数据类型\n\n```tsx\nexport type ProgressColor =\n | string\n | readonly string[]\n | readonly ProgressColorStop[];\n\nexport type PercentPosition = {\n type?: 'inner' | 'outer';\n align?: 'left' | 'center' | 'right';\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-primary-soft-pressed` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Progress 组件源码](./sources/progress/Progress.tsx.txt) · [示例源码](./sources/progress/demo.tsx.txt) · [文档源码](./sources/progress/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Progress } from 'daisu-ui';\nimport type { ProgressColor } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst colors = ['var(--cso-ui-success)', 'var(--cso-ui-warning)', 'var(--cso-ui-danger)', 'var(--cso-ui-primary)'];\nconst colorStops: ProgressColor = [{ color: 'var(--cso-ui-warning)', percentage: 30 }, { color: 'var(--cso-ui-danger)', percentage: 60 }, { color: 'var(--cso-ui-primary)', percentage: 80 }, { color: 'var(--cso-ui-text)', percentage: 90 }];\nexport function ProgressExample() {\n const [percentage, setPercentage] = useState(50);\n return <view className=\"demo-progress-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Progress percentage={50} /></ExampleBlock><ExampleBlock title=\"内置百分比\"><view className=\"demo-progress-rows\"><Progress percentage={50} percentPosition={{ type: 'inner', align: 'center' }} /><Progress percentage={50} status=\"success\" percentPosition={{ type: 'inner', align: 'right' }} /><Progress percentage={50} status=\"danger\" percentPosition={{ type: 'inner', align: 'left' }} /><Progress percentage={0} percentPosition={{ type: 'inner', align: 'center' }} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"进度条状态\"><view className=\"demo-progress-rows\">{(['success','danger','warning'] as const).map(status => <Progress key={status} percentage={50} status={status} hideText />)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"不显示进度文字\"><Progress percentage={50} hideText /></ExampleBlock><ExampleBlock title=\"修改颜色\"><view className=\"demo-progress-rows\">{['var(--cso-ui-primary)', 'var(--cso-ui-success)', 'var(--cso-ui-warning)'].map(color => <Progress key={color} percentage={50} color={color} />)}</view></ExampleBlock><ExampleBlock title=\"颜色数组\"><view className=\"demo-progress-rows\"><Progress percentage={50} color={colors} /><Progress percentage={50} color={colorStops} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"动态控制\"><Progress percentage={percentage} /><view className=\"demo-progress-actions\"><Button size=\"small\" tone=\"danger\" label=\"-10\" onTap={() => { 'background only'; setPercentage(value => Math.max(0, value - 10)); }} /><Button size=\"small\" tone=\"success\" label=\"+10\" onTap={() => { 'background only'; setPercentage(value => Math.min(100, value + 10)); }} /></view></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"percentage","type":"number","optional":true,"description":"百分比;有限值裁剪至 0–100,NaN/Infinity 按 0 处理","defaultValue":"0"},{"name":"hideText","type":"boolean","optional":true,"description":"隐藏百分比;指定 status 时显示状态图标","defaultValue":"false","values":[false,true]},{"name":"color","type":"ProgressColor","optional":true,"description":"字符串、只读字符串数组或 { color, percentage }[],覆盖状态的进度条颜色"},{"name":"status","type":"'success' | 'danger' | 'warning'","optional":true,"description":"success / danger / warning,使用公共 Icon 和语义颜色","values":["success","warning","danger"]},{"name":"duration","type":"number","optional":true,"description":"每变化 1% 的毫秒数;0 立即更新,非法值回退 30","defaultValue":"30"},{"name":"percentPosition","type":"PercentPosition","optional":true,"description":"{ type?: 'inner' | 'outer', align?: 'left' | 'center' | 'right' };align 用于内部文本"},{"name":"className","type":"string","optional":true,"description":"根节点样式;可用 style.height 调整组件高度,内部模式轨道占满高度","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式;可用 style.height 调整组件高度,内部模式轨道占满高度"}],"events":[],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","显示进度"],"title":"显示进度","section":"基础用法","description":"通过 `percentage` 设置完成百分比。","language":"tsx","code":"<Progress percentage={60} />\n","blocks":[{"language":"tsx","code":"<Progress percentage={60} />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义颜色"],"title":"自定义颜色","section":"组件样式","description":"通过 `color` 设置进度条颜色。","language":"tsx","code":"<Progress percentage={80} color=\"#12b886\" />\n","blocks":[{"language":"tsx","code":"<Progress percentage={80} color=\"#12b886\" />\n"}]}],"allowUnknownProps":false},{"name":"QrCode","id":"qr-code","label":"QRCode 二维码","category":"数据展示","categoryId":"display","kind":"component","description":"二维码用于将文本或链接编码为可扫描图案,支持尺寸、颜色与导出。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/QrCode.tsx","docPath":"docs/ui/components/qr-code.md","doc":"# QRCode 二维码\n\n二维码用于将文本或链接编码为可扫描图案,支持尺寸、颜色与导出。\n\n```tsx\nimport { QrCode } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 文本与链接\n\n通过 `text` 设置二维码内容,可以传入普通文字或链接。\n\n```tsx\n<QrCode text=\"https://example.com\" />\n```\n\n## 组件样式\n\n### 颜色与尺寸\n\n通过 `size` 设置二维码尺寸,通过 `colorDark` 设置深色模块颜色。\n\n```tsx\n<QrCode text=\"Daisu UI\" size={180} colorDark=\"#1c64fd\" />\n```\n\n## 平台与资源说明\n\n浏览器宿主须在挂载 lynx-view 前调用 daisu-ui/web 的 registerDaisuWebComponents。设置 exportMode=\"browser\" 后,exportImage 异步加载并内嵌 Logo/背景,返回完整 PNG data URL;示例用 Img 展示真实返回值。跨域图片需允许 CORS。默认 svg 模式拒绝未内嵌的外部图片,避免导出缺图;getSvg 保留原始图片引用。Flutter 尚无位图合成后端。\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 显示文字 | `string` | — |\n| size | 尺寸 | `number` | — |\n| correctLevel | 二维码纠错级别 | `'L' \\| 'M' \\| 'Q' \\| 'H'` | — |\n| colorDark | 二维码深色模块颜色 | `string` | — |\n| colorLight | 二维码浅色模块颜色 | `string` | — |\n| margin | 外部留白或码图边距 | `number` | — |\n| logo | 二维码中心图标地址 | `string` | — |\n| logoWidth | 中心图标宽度 | `number` | — |\n| logoHeight | 中心图标高度 | `number` | — |\n| logoBackgroundColor | 中心图标背景色 | `string` | — |\n| logoRadius | 中心图标圆角 | `number` | — |\n| logoBorderColor | 中心图标边框色 | `string` | — |\n| logoBorderWidth | 中心图标边框宽度 | `number` | — |\n| dotType | 二维码模块形状 | `'square' \\| 'dots' \\| 'rounded' \\| 'liquid'` | — |\n| dotScale | 二维码模块缩放比例 | `number` | — |\n| enableGradient | 是否使用渐变色 | `boolean` | — |\n| gradientColor | 渐变结束颜色 | `string` | — |\n| gradientColors | 渐变颜色列表 | `string[]` | — |\n| gradientDirection | 渐变方向 | `'diagonal' \\| 'horizontal' \\| 'vertical' \\| number` | — |\n| backgroundImage | 背景图片地址 | `string` | — |\n| exportMode | exportMode 配置 | `'svg'\\|'browser'` | `'svg'` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onClick | 点击时触发 | ()=>void |\n| onError | 发生错误时触发 | (error:Error)=>void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| exportImage | 调用实例方法 | ()=>Promise<string> |\n| getSvg | 调用实例方法 | ()=>string |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[QrCode 组件源码](./sources/qr-code/QrCode.tsx.txt) · [示例源码](./sources/qr-code/demo.tsx.txt) · [文档源码](./sources/qr-code/docs.md.txt)\n","demoSource":"import { useInitData,useRef,useState } from '@lynx-js/react';\nimport { Button, Img, QrCode } from 'daisu-ui';\nimport type { QrCodeProps, QrCodeRef } from 'daisu-ui';\nimport { DemoGroup,ExampleBlock } from './shared.js';\nimport logo from '../../../assets/demo-cat.png';\nfunction Code(props:QrCodeProps){return <view className=\"demo-qr-center\"><QrCode text=\"https://example.com\" {...props}/></view>;}\nexport function QrCodeExample(){\n const init=useInitData() as unknown,browser=!!init&&typeof init==='object'&&'browserMedia' in init&&init.browserMedia===true;\n const ref=useRef<QrCodeRef>(null),[image,setImage]=useState(''),[error,setError]=useState('');\n return <view className=\"demo-qr-page\"><DemoGroup title=\"基础用法\">\n <ExampleBlock title=\"基础二维码\"><Code/></ExampleBlock><ExampleBlock title=\"自定义尺寸\"><Code size={280}/></ExampleBlock><ExampleBlock title=\"自定义颜色\"><Code colorDark=\"#3c9cff\" colorLight=\"#f2f7ff\"/></ExampleBlock>\n </DemoGroup><DemoGroup title=\"样式能力\">\n <ExampleBlock title=\"带 Logo\"><Code logo={logo}/></ExampleBlock><ExampleBlock title=\"Logo 样式\"><Code logo={logo} logoWidth={52} logoHeight={52} logoRadius={12} logoBorderColor=\"#ffffff\" logoBorderWidth={4}/></ExampleBlock>\n <ExampleBlock title=\"码点样式\"><view className=\"demo-qr-grid\">{(['dots','rounded','liquid'] as const).map((type,i)=><view key={type} className=\"demo-qr-style\"><QrCode text=\"https://example.com\" size={140} dotType={type} dotScale={type==='dots'?.9:1}/><text className=\"demo-qr-label\">{['圆点','圆角','液态'][i]}</text></view>)}</view></ExampleBlock>\n </DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"渐变颜色\"><Code enableGradient gradientDirection={45} gradientColors={['#4f46e5','#06b6d4','#10b981']}/></ExampleBlock><ExampleBlock title=\"背景图片\"><Code backgroundImage={logo} colorDark=\"rgba(255, 255, 255, 0.8)\" colorLight=\"rgba(15, 31, 50, 0.88)\" margin={4}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"方法\"><ExampleBlock title=\"导出图片\"><view className=\"demo-qr-center\"><QrCode ref={ref} exportMode={browser?'browser':'svg'} text=\"https://example.com\" logo={logo}/></view><view className=\"demo-qr-actions\"><Button label=\"导出二维码\" size=\"small\" onTap={async()=>{'background only';try{setImage(await ref.current!.exportImage());setError('');}catch(e){setError(String(e));}}}/></view>{image?<view className=\"demo-qr-result\"><text className=\"demo-qr-label\">导出结果</text><Img src={image} width={200} height={200} mode=\"aspectFit\"/></view>:null}{error?<text>{error}</text>:null}</ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"text","type":"string","optional":true,"description":"显示文字"},{"name":"size","type":"number","optional":true,"description":"尺寸"},{"name":"correctLevel","type":"'L' | 'M' | 'Q' | 'H'","optional":true,"description":"二维码纠错级别","values":["L","M","Q","H"]},{"name":"colorDark","type":"string","optional":true,"description":"二维码深色模块颜色"},{"name":"colorLight","type":"string","optional":true,"description":"二维码浅色模块颜色"},{"name":"margin","type":"number","optional":true,"description":"外部留白或码图边距"},{"name":"logo","type":"string","optional":true,"description":"二维码中心图标地址"},{"name":"logoWidth","type":"number","optional":true,"description":"中心图标宽度"},{"name":"logoHeight","type":"number","optional":true,"description":"中心图标高度"},{"name":"logoBackgroundColor","type":"string","optional":true,"description":"中心图标背景色"},{"name":"logoRadius","type":"number","optional":true,"description":"中心图标圆角"},{"name":"logoBorderColor","type":"string","optional":true,"description":"中心图标边框色"},{"name":"logoBorderWidth","type":"number","optional":true,"description":"中心图标边框宽度"},{"name":"dotType","type":"'square' | 'dots' | 'rounded' | 'liquid'","optional":true,"description":"二维码模块形状","values":["dots","square","rounded","liquid"]},{"name":"dotScale","type":"number","optional":true,"description":"二维码模块缩放比例"},{"name":"enableGradient","type":"boolean","optional":true,"description":"是否使用渐变色","values":[false,true]},{"name":"gradientColor","type":"string","optional":true,"description":"渐变结束颜色"},{"name":"gradientColors","type":"string[]","optional":true,"description":"渐变颜色列表"},{"name":"gradientDirection","type":"'diagonal' | 'horizontal' | 'vertical' | number","optional":true,"description":"渐变方向"},{"name":"backgroundImage","type":"string","optional":true,"description":"背景图片地址"},{"name":"exportMode","type":"'svg'|'browser'","optional":true,"description":"exportMode 配置","defaultValue":"'svg'","values":["svg","browser"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onClick","type":"()=>void","optional":true,"description":"点击时触发"},{"name":"onError","type":"(error:Error)=>void","optional":true,"description":"发生错误时触发"}],"slots":[],"methods":[{"name":"exportImage","description":"调用实例方法","type":"()=>Promise<string>"},{"name":"getSvg","description":"调用实例方法","type":"()=>string"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","文本与链接"],"title":"文本与链接","section":"基础用法","description":"通过 `text` 设置二维码内容,可以传入普通文字或链接。","language":"tsx","code":"<QrCode text=\"https://example.com\" />\n","blocks":[{"language":"tsx","code":"<QrCode text=\"https://example.com\" />\n"}]},{"name":"demo-2","aliases":["demo-2","颜色与尺寸"],"title":"颜色与尺寸","section":"组件样式","description":"通过 `size` 设置二维码尺寸,通过 `colorDark` 设置深色模块颜色。","language":"tsx","code":"<QrCode text=\"Daisu UI\" size={180} colorDark=\"#1c64fd\" />\n","blocks":[{"language":"tsx","code":"<QrCode text=\"Daisu UI\" size={180} colorDark=\"#1c64fd\" />\n"}]}],"allowUnknownProps":false},{"name":"Radio","id":"radio","label":"Radio 单选","category":"录入","categoryId":"form","kind":"component","description":"单选框用于从互斥选项中选择一项,通过 RadioGroup 管理选中值和公共属性。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Radio.tsx","docPath":"docs/ui/components/radio.md","doc":"# Radio 单选\n\n单选框用于从互斥选项中选择一项,通过 RadioGroup 管理选中值和公共属性。\n\n```tsx\nimport { Radio, RadioGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 单选框组\n\n通过 `RadioGroup.value` 与 `onChange` 管理当前选项,每个 `Radio.value` 指定选项值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n```\n\n## 组件状态\n\n### 禁用选项\n\n在选项上设置 `disabled`,该选项不能被选中。\n\n```tsx\n<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n```\n\n## 组件变体\n\n### 按钮单选框\n\n设置 `RadioGroup.type=\"button\"` 使用按钮外观。\n\n```tsx\n<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n```\n\n## Attributes 属性\n\n### Radio\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `ChoiceValue` | 必填 |\n\n### RadioGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `T \\| null` | — |\n| defaultValue | 非受控模式的初始值 | `T \\| null` | — |\n| allowUncheck | 是否允许取消当前选项 | `boolean` | — |\n| options | 选项配置 | `RadioOption[]` | — |\n\n泛型约束:`T extends ChoiceValue = ChoiceValue`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| RadioGroup.onChange | 值发生变化时触发 | (value: T \\| null) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Radio.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| Radio.children | 自定义内容 | ReactNode |\n| RadioGroup.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| RadioGroup.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ChoiceType = 'circle' | 'square' | 'dot' | 'button';\n\nexport type ChoiceValue = string | number | boolean;\n\nexport type RadioOption = {\n label: string;\n value: string;\n disabled?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Radio 组件源码](./sources/radio/Radio.tsx.txt) · [RadioGroup 组件源码](./sources/radio/Radio.tsx.txt) · [示例源码](./sources/radio/demo.tsx.txt) · [文档源码](./sources/radio/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, Divider, Icon, Radio, RadioGroup } from 'daisu-ui';import type { RadioGroupProps, RadioProps } from 'daisu-ui';import { DemoGroup,ExampleBlock } from './shared.js';\ntype Item=Pick<RadioProps,'value'|'type'|'placement'|'disabled'|'checkedColor'|'renderIcon'>&{label:string};\nconst options:Item[]=[{value:1,label:'选项1'},{value:2,label:'选项2'}],mixed:Item[]=[{value:1,label:'单选框1'},{value:3,label:'单选框2',type:'square'},{value:5,label:'单选框2',type:'dot'}];\nfunction Sample({items=options,...props}:Omit<RadioGroupProps<number>,'children'>&{items?:Item[]}){const[value,setValue]=useState<number|null>(1);return <RadioGroup<number> {...props} value={value} onChange={setValue} className={`demo-choice-group ${props.className??''}`}>{items.map(({label,...item})=><Radio {...item} key={String(item.value)}>{label}</Radio>)}</RadioGroup>;}\nconst line=<Divider dashed className=\"demo-choice-divider\"/>;\nexport function RadioExample(){const[cell,setCell]=useState<number|null>(1);return <view className=\"demo-radio-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Sample items={mixed}/></ExampleBlock><ExampleBlock title=\"修改形状--button\"><Sample type=\"button\" items={[{value:1,label:'选项1',placement:'right'},options[1]!]}/></ExampleBlock></DemoGroup><DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\"><Sample disabled type=\"dot\"/>{line}<Sample disabled/>{line}<Sample disabled type=\"button\"/>{line}<Sample disabled type=\"square\"/></ExampleBlock><ExampleBlock title=\"只读状态\"><Sample readonly/></ExampleBlock><ExampleBlock title=\"允许取消选中\"><Sample allowUncheck items={[{value:1,label:'支持取消选中'},{value:2,label:'支持取消选中'}]}/></ExampleBlock></DemoGroup><DemoGroup title=\"组件样式\"><ExampleBlock title=\"图标位置\"><Sample items={mixed}/>{line}<Sample items={mixed} placement=\"right\"/></ExampleBlock><ExampleBlock title=\"修改选中颜色\"><Sample checkedColor=\"#f14646\"/>{line}<Sample type=\"dot\" checkedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"修改未选中颜色\"><Sample uncheckedColor=\"#f14646\"/></ExampleBlock></DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"radio的props比radioGroup的优先级高\"><Sample type=\"button\" disabled checkedColor=\"#f14646\" items={[{value:1,label:'选项1',disabled:false,checkedColor:'#1d1f29'},{value:2,label:'选项2',disabled:false},{value:3,label:'选项3'}]}/></ExampleBlock><ExampleBlock title=\"结合 Cell 使用\" noPadding><RadioGroup<number> value={cell} checkedColor=\"#f14646\" onChange={setCell}><CellGroup border>{[1,2].map(value=><Cell key={value} title={`单选框 ${value}`} clickable onTap={()=>setCell(value)}><Radio value={value}/></Cell>)}</CellGroup></RadioGroup></ExampleBlock><ExampleBlock title=\"自定义图标\"><Sample items={[1,2].map(value=>({value,label:'自定义图标',renderIcon:({isChecked})=><Icon size={22} name={isChecked?'star-fill':'star'} color={isChecked?'#f14646':'#a9acb8'}/>}))}/></ExampleBlock></DemoGroup><DemoGroup title=\"布局能力\"><ExampleBlock title=\"同行展示\"><Sample direction=\"horizontal\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'},{value:3,label:'单选框2',placement:'right'}]}/>{line}<Sample direction=\"horizontal\" type=\"dot\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'}]}/>{line}<Sample direction=\"horizontal\" type=\"square\" placement=\"right\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'}]}/></ExampleBlock></DemoGroup></view>;}\n","props":[{"name":"type","type":"ChoiceType","optional":true,"description":"类型","values":["dot","circle","square","button"]},{"name":"checkedColor","type":"string","optional":true,"description":"选中颜色"},{"name":"uncheckedColor","type":"string","optional":true,"description":"未选中颜色"},{"name":"disabled","type":"boolean | null","optional":true,"description":"是否禁用"},{"name":"readonly","type":"boolean | null","optional":true,"description":"是否只读"},{"name":"placement","type":"'left' | 'right'","optional":true,"description":"浮层相对触发元素的位置","values":["left","right"]},{"name":"direction","type":"'horizontal' | 'vertical'","optional":true,"description":"布局或展开方向","values":["vertical","horizontal"]},{"name":"size","type":"'large'","optional":true,"description":"尺寸","values":["large"]},{"name":"maxWidth","type":"string","optional":true,"description":"最大宽度"},{"name":"labelClassName","type":"string","optional":true,"description":"选项文字类名"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"value","type":"ChoiceValue","optional":false,"description":"当前值;传入后由调用方更新"}],"events":[],"slots":[{"name":"renderIcon","type":"(state: { isChecked: boolean }) => ReactNode","optional":true,"description":""},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","单选框组"],"title":"单选框组","section":"组件类型","description":"通过 `RadioGroup.value` 与 `onChange` 管理当前选项,每个 `Radio.value` 指定选项值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用选项"],"title":"禁用选项","section":"组件状态","description":"在选项上设置 `disabled`,该选项不能被选中。","language":"tsx","code":"<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n"}]},{"name":"demo-3","aliases":["demo-3","按钮单选框"],"title":"按钮单选框","section":"组件变体","description":"设置 `RadioGroup.type=\"button\"` 使用按钮外观。","language":"tsx","code":"<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n"}]}],"allowUnknownProps":false},{"name":"RadioGroup","id":"radio","label":"Radio 单选","category":"录入","categoryId":"form","kind":"component","description":"单选框用于从互斥选项中选择一项,通过 RadioGroup 管理选中值和公共属性。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Radio.tsx","docPath":"docs/ui/components/radio.md","doc":"# Radio 单选\n\n单选框用于从互斥选项中选择一项,通过 RadioGroup 管理选中值和公共属性。\n\n```tsx\nimport { Radio, RadioGroup } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 单选框组\n\n通过 `RadioGroup.value` 与 `onChange` 管理当前选项,每个 `Radio.value` 指定选项值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n```\n\n## 组件状态\n\n### 禁用选项\n\n在选项上设置 `disabled`,该选项不能被选中。\n\n```tsx\n<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n```\n\n## 组件变体\n\n### 按钮单选框\n\n设置 `RadioGroup.type=\"button\"` 使用按钮外观。\n\n```tsx\n<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n```\n\n## Attributes 属性\n\n### Radio\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `ChoiceValue` | 必填 |\n\n### RadioGroup\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | 类型 | `ChoiceType` | — |\n| checkedColor | 选中颜色 | `string` | — |\n| uncheckedColor | 未选中颜色 | `string` | — |\n| disabled | 是否禁用 | `boolean \\| null` | — |\n| readonly | 是否只读 | `boolean \\| null` | — |\n| placement | 浮层相对触发元素的位置 | `'left' \\| 'right'` | — |\n| direction | 布局或展开方向 | `'horizontal' \\| 'vertical'` | — |\n| size | 尺寸 | `'large'` | — |\n| maxWidth | 最大宽度 | `string` | — |\n| labelClassName | 选项文字类名 | `string` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| value | 当前值;传入后由调用方更新 | `T \\| null` | — |\n| defaultValue | 非受控模式的初始值 | `T \\| null` | — |\n| allowUncheck | 是否允许取消当前选项 | `boolean` | — |\n| options | 选项配置 | `RadioOption[]` | — |\n\n泛型约束:`T extends ChoiceValue = ChoiceValue`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| RadioGroup.onChange | 值发生变化时触发 | (value: T \\| null) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Radio.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| Radio.children | 自定义内容 | ReactNode |\n| RadioGroup.renderIcon | 自定义图标 | (state: { isChecked: boolean }) => ReactNode |\n| RadioGroup.children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ChoiceType = 'circle' | 'square' | 'dot' | 'button';\n\nexport type ChoiceValue = string | number | boolean;\n\nexport type RadioOption = {\n label: string;\n value: string;\n disabled?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Radio 组件源码](./sources/radio/Radio.tsx.txt) · [RadioGroup 组件源码](./sources/radio/Radio.tsx.txt) · [示例源码](./sources/radio/demo.tsx.txt) · [文档源码](./sources/radio/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, Divider, Icon, Radio, RadioGroup } from 'daisu-ui';import type { RadioGroupProps, RadioProps } from 'daisu-ui';import { DemoGroup,ExampleBlock } from './shared.js';\ntype Item=Pick<RadioProps,'value'|'type'|'placement'|'disabled'|'checkedColor'|'renderIcon'>&{label:string};\nconst options:Item[]=[{value:1,label:'选项1'},{value:2,label:'选项2'}],mixed:Item[]=[{value:1,label:'单选框1'},{value:3,label:'单选框2',type:'square'},{value:5,label:'单选框2',type:'dot'}];\nfunction Sample({items=options,...props}:Omit<RadioGroupProps<number>,'children'>&{items?:Item[]}){const[value,setValue]=useState<number|null>(1);return <RadioGroup<number> {...props} value={value} onChange={setValue} className={`demo-choice-group ${props.className??''}`}>{items.map(({label,...item})=><Radio {...item} key={String(item.value)}>{label}</Radio>)}</RadioGroup>;}\nconst line=<Divider dashed className=\"demo-choice-divider\"/>;\nexport function RadioExample(){const[cell,setCell]=useState<number|null>(1);return <view className=\"demo-radio-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Sample items={mixed}/></ExampleBlock><ExampleBlock title=\"修改形状--button\"><Sample type=\"button\" items={[{value:1,label:'选项1',placement:'right'},options[1]!]}/></ExampleBlock></DemoGroup><DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用\"><Sample disabled type=\"dot\"/>{line}<Sample disabled/>{line}<Sample disabled type=\"button\"/>{line}<Sample disabled type=\"square\"/></ExampleBlock><ExampleBlock title=\"只读状态\"><Sample readonly/></ExampleBlock><ExampleBlock title=\"允许取消选中\"><Sample allowUncheck items={[{value:1,label:'支持取消选中'},{value:2,label:'支持取消选中'}]}/></ExampleBlock></DemoGroup><DemoGroup title=\"组件样式\"><ExampleBlock title=\"图标位置\"><Sample items={mixed}/>{line}<Sample items={mixed} placement=\"right\"/></ExampleBlock><ExampleBlock title=\"修改选中颜色\"><Sample checkedColor=\"#f14646\"/>{line}<Sample type=\"dot\" checkedColor=\"#f14646\"/></ExampleBlock><ExampleBlock title=\"修改未选中颜色\"><Sample uncheckedColor=\"#f14646\"/></ExampleBlock></DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"radio的props比radioGroup的优先级高\"><Sample type=\"button\" disabled checkedColor=\"#f14646\" items={[{value:1,label:'选项1',disabled:false,checkedColor:'#1d1f29'},{value:2,label:'选项2',disabled:false},{value:3,label:'选项3'}]}/></ExampleBlock><ExampleBlock title=\"结合 Cell 使用\" noPadding><RadioGroup<number> value={cell} checkedColor=\"#f14646\" onChange={setCell}><CellGroup border>{[1,2].map(value=><Cell key={value} title={`单选框 ${value}`} clickable onTap={()=>setCell(value)}><Radio value={value}/></Cell>)}</CellGroup></RadioGroup></ExampleBlock><ExampleBlock title=\"自定义图标\"><Sample items={[1,2].map(value=>({value,label:'自定义图标',renderIcon:({isChecked})=><Icon size={22} name={isChecked?'star-fill':'star'} color={isChecked?'#f14646':'#a9acb8'}/>}))}/></ExampleBlock></DemoGroup><DemoGroup title=\"布局能力\"><ExampleBlock title=\"同行展示\"><Sample direction=\"horizontal\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'},{value:3,label:'单选框2',placement:'right'}]}/>{line}<Sample direction=\"horizontal\" type=\"dot\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'}]}/>{line}<Sample direction=\"horizontal\" type=\"square\" placement=\"right\" items={[{value:1,label:'单选框1'},{value:2,label:'单选框2'}]}/></ExampleBlock></DemoGroup></view>;}\n","props":[{"name":"type","type":"ChoiceType","optional":true,"description":"类型","values":["dot","circle","square","button"]},{"name":"checkedColor","type":"string","optional":true,"description":"选中颜色"},{"name":"uncheckedColor","type":"string","optional":true,"description":"未选中颜色"},{"name":"disabled","type":"boolean | null","optional":true,"description":"是否禁用"},{"name":"readonly","type":"boolean | null","optional":true,"description":"是否只读"},{"name":"placement","type":"'left' | 'right'","optional":true,"description":"浮层相对触发元素的位置","values":["left","right"]},{"name":"direction","type":"'horizontal' | 'vertical'","optional":true,"description":"布局或展开方向","values":["vertical","horizontal"]},{"name":"size","type":"'large'","optional":true,"description":"尺寸","values":["large"]},{"name":"maxWidth","type":"string","optional":true,"description":"最大宽度"},{"name":"labelClassName","type":"string","optional":true,"description":"选项文字类名"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"value","type":"T | null","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"T | null","optional":true,"description":"非受控模式的初始值"},{"name":"allowUncheck","type":"boolean","optional":true,"description":"是否允许取消当前选项","values":[false,true]},{"name":"options","type":"RadioOption[]","optional":true,"description":"选项配置"}],"events":[{"name":"onChange","type":"(value: T | null) => void","optional":true,"description":""}],"slots":[{"name":"renderIcon","type":"(state: { isChecked: boolean }) => ReactNode","optional":true,"description":""},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","单选框组"],"title":"单选框组","section":"组件类型","description":"通过 `RadioGroup.value` 与 `onChange` 管理当前选项,每个 `Radio.value` 指定选项值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | null>('one');\n\n<RadioGroup value={value} onChange={setValue}>\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用选项"],"title":"禁用选项","section":"组件状态","description":"在选项上设置 `disabled`,该选项不能被选中。","language":"tsx","code":"<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"<RadioGroup defaultValue=\"one\">\n <Radio value=\"one\">可用选项</Radio>\n <Radio value=\"two\" disabled>\n 禁用选项\n </Radio>\n</RadioGroup>\n"}]},{"name":"demo-3","aliases":["demo-3","按钮单选框"],"title":"按钮单选框","section":"组件变体","description":"设置 `RadioGroup.type=\"button\"` 使用按钮外观。","language":"tsx","code":"<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n","blocks":[{"language":"tsx","code":"<RadioGroup type=\"button\" defaultValue=\"one\">\n <Radio value=\"one\">选项一</Radio>\n <Radio value=\"two\">选项二</Radio>\n</RadioGroup>\n"}]}],"allowUnknownProps":false},{"name":"Rate","id":"rate","label":"Rate 评分","category":"录入","categoryId":"form","kind":"component","description":"评分用于展示或选择评分等级,支持半星、只读、禁用和自定义图标。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Rate.tsx","docPath":"docs/ui/components/rate.md","doc":"# Rate 评分\n\n评分用于展示或选择评分等级,支持半星、只读、禁用和自定义图标。\n\n```tsx\nimport { Rate } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 受控评分\n\n通过 `value` 和 `onChange` 管理评分,事件中的 `value` 为选中的分值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(3);\n\n<Rate\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n```\n\n## 组件状态\n\n### 只读与禁用\n\n设置 `readonly` 展示只读评分,设置 `disabled` 展示禁用状态。\n\n```tsx\n<Rate value={4} readonly />\n<Rate value={3} disabled />\n```\n\n## 组件样式\n\n### 数量与尺寸\n\n通过 `num` 设置评分图标数量,`size` 设置尺寸,`color` 设置未选中图标颜色。\n\n```tsx\n<Rate num={5} size={28} color=\"#f57f00\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `number \\| null` | — |\n| defaultValue | 非受控模式的初始值 | `number` | `0` |\n| num | 评分图标数量 | `number` | `5` |\n| readonly | 是否只读 | `boolean` | `false` |\n| disabled | 是否禁用 | `boolean` | — |\n| size | 尺寸 | `number \\| string` | `24` |\n| space | 相邻项间距 | `number \\| string` | `6` |\n| color | 内容颜色 | `string` | — |\n| activeColor | 选中状态颜色 | `string \\| readonly string[]` | `'#faad14'` |\n| disabledColor | 禁用状态颜色 | `string` | — |\n| icon | 图标内容 | `IconName` | `'star-fill'` |\n| activeIcon | 激活状态图标 | `IconName` | `'star-fill'` |\n| allowHalf | 是否允许选择半星 | `boolean` | `false` |\n| clearable | 是否显示清空入口 | `boolean` | `false` |\n| block | 是否占满父容器宽度 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: number }) => void |\n\n## 数据类型\n\n```tsx\nexport type IconName = keyof typeof iconPaths;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n\n## 源代码\n\n[Rate 组件源码](./sources/rate/Rate.tsx.txt) · [示例源码](./sources/rate/demo.tsx.txt) · [文档源码](./sources/rate/docs.md.txt)\n","demoSource":"import { Rate } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst yellow = 'linear-gradient(180deg, rgba(255,238,0,1) 0%, rgba(250,176,21,1) 100%)';\nconst red = 'linear-gradient(315deg, rgba(245,34,34,1) 0%, rgba(255,117,102,1) 100%)';\nexport function RateExample() {\n return <view>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Rate defaultValue={5} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"只读状态 readonly\"><Rate defaultValue={3} readonly /></ExampleBlock><ExampleBlock title=\"禁用状态\"><Rate defaultValue={2} disabled /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"修改选中颜色\"><view className=\"demo-rate-stack\"><Rate defaultValue={4} activeColor={yellow} /><Rate defaultValue={3} activeColor={[yellow, red]} /></view></ExampleBlock>\n <ExampleBlock title=\"修改icon和选中颜色\"><view className=\"demo-rate-stack\"><Rate defaultValue={3} block icon=\"heart-fill\" activeIcon=\"heart-fill\" activeColor=\"#f14646\" /><Rate defaultValue={3} block icon=\"thumb-down-fill\" activeIcon=\"thumb-up-fill\" activeColor=\"#12b886\" /></view></ExampleBlock>\n <ExampleBlock title=\"修改size、space\"><Rate defaultValue={3} size={36} space=\"12px\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"允许半选\"><Rate defaultValue={2.5} allowHalf /></ExampleBlock>\n <ExampleBlock title=\"允许清空评分\"><view className=\"demo-rate-stack\"><Rate defaultValue={1} clearable /><Rate defaultValue={.5} clearable allowHalf /></view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"value","type":"number | null","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"number","optional":true,"description":"非受控模式的初始值","defaultValue":"0"},{"name":"num","type":"number","optional":true,"description":"评分图标数量","defaultValue":"5"},{"name":"readonly","type":"boolean","optional":true,"description":"是否只读","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"size","type":"number | string","optional":true,"description":"尺寸","defaultValue":"24"},{"name":"space","type":"number | string","optional":true,"description":"相邻项间距","defaultValue":"6"},{"name":"color","type":"string","optional":true,"description":"内容颜色"},{"name":"activeColor","type":"string | readonly string[]","optional":true,"description":"选中状态颜色","defaultValue":"'#faad14'"},{"name":"disabledColor","type":"string","optional":true,"description":"禁用状态颜色"},{"name":"icon","type":"IconName","optional":true,"description":"图标内容","defaultValue":"'star-fill'","values":["number","info","phone","underline","zoom-in","zoom-out","filter","left","right","translate","expand","del","multiple-horizontal","left-circle","down-circle","caret-down","double-left","caret-right","double-right","double-down","down","arrow-right","caret-left","arrow-down","arrow-left","up","arrow-rise","double-up","to-right","up-circle","sort-fill","to-top","to-left","menu-fold","swap","drag-arrow","sort-fill-1","to-bottom","caret-up","rotate-left","arrow-up","arrow-fall","menu-unfold","rotate-right","shrink","right-circle","bold","filter-fill","deleteall","brush","font-colors","edit","find-replace","eraser","copy","delete","circular","bg-colors","align-right","align-center","align-left","unordered-list","undo","sort-ascending","scissor","quote","sort-descending","link","ordered-list","h3","h4","italic","redo","highlight","original-size","h1","h5","oblique-line","line-height","h7","h2","apps","application","no-wifi","no-result","no-product","no-message","no-content","no-comment","no-collection","failpayment","formula","sort","textarea","paste","h6","strikethrough","drag-dot","dice","drive-file","email","drag-dot-vertical","compass","dashboard","common","desktop","copyright","cloud","company","command","camera","camera-fill","branch","calendar-line","bug","bulb","book","archive","gift","image-failloading","interaction","image-close","Fire","image","idcard","folder-add","face-frown-fill","folder","folder-delete","file-video","file","file-pdf","experiment","file-audio","face-meh-fill","file-image","empty","face-smile-fill","ear","mobile","lock","mind-mapping","location","loop","language","locate","keyboard","loading","layout","printer","pen-fill","organization","notification-close","old-version","moon","notification","nav","mosaic","man","moon-fill","menu","tags","tag","thunderbolt","sun","store","sun-fill","subscribed","stamp","subscribe","skin","storage","subscribe-add","shake","safe","public","pen","robot","robot-add","pushpin","qrcode","eye-fill","code","code-square","Export","download","clock-circle-fill","code-block","cloud-download","buble-circle-fill","barcode","at","wifi","tool","woman","video-camera","user","user-group","time-line","trophy","user-add","unlock","refresh","more","more-vertical","mic","module-fill","mfill","message","message-banned","lightning-circle-fill","import","list","Launch","home","home-fill","heart","history","headset","heart-fill","headset-off","headset-fill","headset-off-fill","eye","eye-invisible","eye-invisible-fill","live-broadcast","fullscreen","fullscreen-exit","forward","backward","voice","upload","thumb-up","sync","thumb-down","thumb-up-fill","star","thumb-down-fill","share-internal","star-fill","share-external","settings","share-alt","send","select-all","poweroff","search-line","save","scan","reply","check-half-square-fill","check-circle","check-circle-radio-fill","check-circle-fill","sound","skip-next-fill","sound-fill","skip-previous","skip-previous-fill","skip-next","record-stop","record","play-circle","play-circle-fill","play-arrow","play-arrow-fill","pause-circle","pause","mute-fill","pause-circle-fill","music","mute","page-fill","minus-square","minus-square-3px","minus-circle","minus-circle-fill","info-circle","info-circle-fill","exclamation","exclamation-polygon-fill","exclamation-circle","exclamation-circle-fill","doublecheck","close","division","close-circle","close-circle-fill","clock-circle","check","check-square","check-square-fill","uncheck-square","stop","uncheck-circle","question-circle","question","question-circle-fill","plus-square-3px","plus","plus-square","plus-circle","plus-circle-fill","minus"]},{"name":"activeIcon","type":"IconName","optional":true,"description":"激活状态图标","defaultValue":"'star-fill'","values":["number","info","phone","underline","zoom-in","zoom-out","filter","left","right","translate","expand","del","multiple-horizontal","left-circle","down-circle","caret-down","double-left","caret-right","double-right","double-down","down","arrow-right","caret-left","arrow-down","arrow-left","up","arrow-rise","double-up","to-right","up-circle","sort-fill","to-top","to-left","menu-fold","swap","drag-arrow","sort-fill-1","to-bottom","caret-up","rotate-left","arrow-up","arrow-fall","menu-unfold","rotate-right","shrink","right-circle","bold","filter-fill","deleteall","brush","font-colors","edit","find-replace","eraser","copy","delete","circular","bg-colors","align-right","align-center","align-left","unordered-list","undo","sort-ascending","scissor","quote","sort-descending","link","ordered-list","h3","h4","italic","redo","highlight","original-size","h1","h5","oblique-line","line-height","h7","h2","apps","application","no-wifi","no-result","no-product","no-message","no-content","no-comment","no-collection","failpayment","formula","sort","textarea","paste","h6","strikethrough","drag-dot","dice","drive-file","email","drag-dot-vertical","compass","dashboard","common","desktop","copyright","cloud","company","command","camera","camera-fill","branch","calendar-line","bug","bulb","book","archive","gift","image-failloading","interaction","image-close","Fire","image","idcard","folder-add","face-frown-fill","folder","folder-delete","file-video","file","file-pdf","experiment","file-audio","face-meh-fill","file-image","empty","face-smile-fill","ear","mobile","lock","mind-mapping","location","loop","language","locate","keyboard","loading","layout","printer","pen-fill","organization","notification-close","old-version","moon","notification","nav","mosaic","man","moon-fill","menu","tags","tag","thunderbolt","sun","store","sun-fill","subscribed","stamp","subscribe","skin","storage","subscribe-add","shake","safe","public","pen","robot","robot-add","pushpin","qrcode","eye-fill","code","code-square","Export","download","clock-circle-fill","code-block","cloud-download","buble-circle-fill","barcode","at","wifi","tool","woman","video-camera","user","user-group","time-line","trophy","user-add","unlock","refresh","more","more-vertical","mic","module-fill","mfill","message","message-banned","lightning-circle-fill","import","list","Launch","home","home-fill","heart","history","headset","heart-fill","headset-off","headset-fill","headset-off-fill","eye","eye-invisible","eye-invisible-fill","live-broadcast","fullscreen","fullscreen-exit","forward","backward","voice","upload","thumb-up","sync","thumb-down","thumb-up-fill","star","thumb-down-fill","share-internal","star-fill","share-external","settings","share-alt","send","select-all","poweroff","search-line","save","scan","reply","check-half-square-fill","check-circle","check-circle-radio-fill","check-circle-fill","sound","skip-next-fill","sound-fill","skip-previous","skip-previous-fill","skip-next","record-stop","record","play-circle","play-circle-fill","play-arrow","play-arrow-fill","pause-circle","pause","mute-fill","pause-circle-fill","music","mute","page-fill","minus-square","minus-square-3px","minus-circle","minus-circle-fill","info-circle","info-circle-fill","exclamation","exclamation-polygon-fill","exclamation-circle","exclamation-circle-fill","doublecheck","close","division","close-circle","close-circle-fill","clock-circle","check","check-square","check-square-fill","uncheck-square","stop","uncheck-circle","question-circle","question","question-circle-fill","plus-square-3px","plus","plus-square","plus-circle","plus-circle-fill","minus"]},{"name":"allowHalf","type":"boolean","optional":true,"description":"是否允许选择半星","defaultValue":"false","values":[false,true]},{"name":"clearable","type":"boolean","optional":true,"description":"是否显示清空入口","defaultValue":"false","values":[false,true]},{"name":"block","type":"boolean","optional":true,"description":"是否占满父容器宽度","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: number }) => void","optional":true,"description":"值发生变化时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""}],"demos":[{"name":"basic","aliases":["demo-1","受控评分"],"title":"受控评分","section":"组件类型","description":"通过 `value` 和 `onChange` 管理评分,事件中的 `value` 为选中的分值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(3);\n\n<Rate\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(3);\n\n<Rate\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","只读与禁用"],"title":"只读与禁用","section":"组件状态","description":"设置 `readonly` 展示只读评分,设置 `disabled` 展示禁用状态。","language":"tsx","code":"<Rate value={4} readonly />\n<Rate value={3} disabled />\n","blocks":[{"language":"tsx","code":"<Rate value={4} readonly />\n<Rate value={3} disabled />\n"}]},{"name":"demo-3","aliases":["demo-3","数量与尺寸"],"title":"数量与尺寸","section":"组件样式","description":"通过 `num` 设置评分图标数量,`size` 设置尺寸,`color` 设置未选中图标颜色。","language":"tsx","code":"<Rate num={5} size={28} color=\"#f57f00\" />\n","blocks":[{"language":"tsx","code":"<Rate num={5} size={28} color=\"#f57f00\" />\n"}]}],"allowUnknownProps":false},{"name":"registerDaisuWebComponents","id":"register-daisu-web-components","label":"registerDaisuWebComponents","category":"公共 API","categoryId":"api","kind":"utility","description":"registerDaisuWebComponents 公开 API","importFrom":"daisu-ui/web","source":"packages/daisu-ui/src/web/index.ts","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"registerImgCropper","id":"register-img-cropper","label":"registerImgCropper","category":"公共 API","categoryId":"api","kind":"utility","description":"A browser canvas editor, registered only by the browser host.","importFrom":"daisu-ui/web","source":"packages/daisu-ui/src/web/imgCropperElement.ts","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"registerQrCodeExport","id":"register-qr-code-export","label":"registerQrCodeExport","category":"公共 API","categoryId":"api","kind":"utility","description":"registerQrCodeExport 公开 API","importFrom":"daisu-ui/web","source":"packages/daisu-ui/src/web/qrCodeExportElement.ts","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"registerRichTextMedia","id":"register-rich-text-media","label":"registerRichTextMedia","category":"公共 API","categoryId":"api","kind":"utility","description":"Browser-only registration. Importing this module does not read DOM globals.","importFrom":"daisu-ui/web","source":"packages/daisu-ui/src/web/richTextMediaElement.ts","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Resize","id":"resize","label":"Resize 监听元素尺寸变化","category":"基础","categoryId":"basic","kind":"component","description":"尺寸监听器在子内容布局变化时报告矩形信息,适合自适应布局和组件尺寸计算。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Resize.tsx","docPath":"docs/ui/components/resize.md","doc":"# Resize 监听元素尺寸变化\n\n尺寸监听器在子内容布局变化时报告矩形信息,适合自适应布局和组件尺寸计算。\n\n```tsx\nimport { Resize } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 监听布局变化\n\n通过 `onResize` 获取内容布局变化后的宽高信息。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [width, setWidth] = useState(0);\n\n<Resize\n onResize={(rect) => {\n 'background only';\n setWidth(rect.width);\n }}\n>\n <view style={{ width: '100%', height: '80px' }} />\n</Resize>\n<text>{width}px</text>\n```\n\n## 内容形态\n\n### 包裹动态内容\n\n将动态内容放入 `Resize`,内容尺寸变化后通过 `onResize` 获取新的矩形信息。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\nconst [expanded, setExpanded] = useState(false);\n\n<Button\n label=\"展开\"\n onTap={() => {\n 'background only';\n setExpanded(!expanded);\n }}\n/>\n<Resize\n onResize={(rect) => {\n 'background only';\n console.log(rect);\n }}\n>\n <text>{expanded ? '展开后显示更多内容' : '摘要'}</text>\n</Resize>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 被监听的内容 | `ReactNode` | — |\n| className | 根节点类名 | `string` | `''` |\n| containerClassName | 监听容器类名 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onResize | 首次布局和宽 / 高变化时回调 `ResizeRect` | (rect: ResizeRect) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 被监听的内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ResizeRect = {\n width: number;\n height: number;\n top: number;\n right: number;\n bottom: number;\n left: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Resize 组件源码](./sources/resize/Resize.tsx.txt) · [示例源码](./sources/resize/demo.tsx.txt) · [文档源码](./sources/resize/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Resize } from 'daisu-ui';\nimport type { ResizeRect } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst fields = ['width', 'height', 'top', 'right', 'bottom', 'left'] as const;\n\nexport function ResizeExample() {\n const [size, setSize] = useState(0);\n const [geometry, setGeometry] = useState<{ previous: ResizeRect | null; current: ResizeRect | null }>({ previous: null, current: null });\n useEffect(() => { const timer = setTimeout(() => setSize(100), 1500); return () => clearTimeout(timer); }, []);\n const resize = (current: ResizeRect) => { 'background only'; setGeometry(value => ({ previous: value.current, current })); };\n return <view className=\"demo-resize-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础用法\">\n <Resize onResize={resize}><view className=\"demo-resize-target\" style={{ width: `${size}px`, height: `${size}px` }} /></Resize>\n {fields.map(field => <view key={field} className=\"demo-resize-tip\"><text className=\"demo-resize-label\">{field}:</text><text>{geometry.previous?.[field] ?? ''}</text><view className=\"demo-resize-separator\" /><text className={`demo-resize-value demo-resize-${field}`}>{geometry.current?.[field] ?? ''}</text></view>)}\n </ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"className","type":"string","optional":true,"description":"根节点类名","defaultValue":"''"},{"name":"containerClassName","type":"string","optional":true,"description":"监听容器类名","defaultValue":"''"}],"events":[{"name":"onResize","type":"(rect: ResizeRect) => void","optional":true,"description":"首次布局和宽 / 高变化时回调 ResizeRect"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"被监听的内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","监听布局变化"],"title":"监听布局变化","section":"组件类型","description":"通过 `onResize` 获取内容布局变化后的宽高信息。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [width, setWidth] = useState(0);\n\n<Resize\n onResize={(rect) => {\n 'background only';\n setWidth(rect.width);\n }}\n>\n <view style={{ width: '100%', height: '80px' }} />\n</Resize>\n<text>{width}px</text>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [width, setWidth] = useState(0);\n\n<Resize\n onResize={(rect) => {\n 'background only';\n setWidth(rect.width);\n }}\n>\n <view style={{ width: '100%', height: '80px' }} />\n</Resize>\n<text>{width}px</text>\n"}]},{"name":"demo-2","aliases":["demo-2","包裹动态内容"],"title":"包裹动态内容","section":"内容形态","description":"将动态内容放入 `Resize`,内容尺寸变化后通过 `onResize` 获取新的矩形信息。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\nconst [expanded, setExpanded] = useState(false);\n\n<Button\n label=\"展开\"\n onTap={() => {\n 'background only';\n setExpanded(!expanded);\n }}\n/>\n<Resize\n onResize={(rect) => {\n 'background only';\n console.log(rect);\n }}\n>\n <text>{expanded ? '展开后显示更多内容' : '摘要'}</text>\n</Resize>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\nconst [expanded, setExpanded] = useState(false);\n\n<Button\n label=\"展开\"\n onTap={() => {\n 'background only';\n setExpanded(!expanded);\n }}\n/>\n<Resize\n onResize={(rect) => {\n 'background only';\n console.log(rect);\n }}\n>\n <text>{expanded ? '展开后显示更多内容' : '摘要'}</text>\n</Resize>\n"}]}],"allowUnknownProps":false},{"name":"RichText","id":"rich-text","label":"RichText 富文本","category":"数据展示","categoryId":"display","kind":"component","description":"富文本用于展示 HTML 内容,支持段落、图片、表格和媒体内容,并提供点击、加载与预览事件。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/RichText.tsx","docPath":"docs/ui/components/rich-text.md","doc":"# RichText 富文本\n\n富文本用于展示 HTML 内容,支持段落、图片、表格和媒体内容,并提供点击、加载与预览事件。\n\n```tsx\nimport { RichText } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 展示 HTML\n\n通过 `content` 传入 HTML 字符串,组件展示其中的段落、标题等内容。\n\n```tsx\n<RichText content=\"<h2>文章标题</h2><p>这里是文章正文。</p>\" />\n```\n\n## 内容形态\n\n### 表格与列表\n\n`content` 支持表格和列表标签,可在同一段富文本中组合展示。\n\n```tsx\n<RichText content=\"<ul><li>项目一</li><li>项目二</li></ul><table><tr><td>名称</td><td>数值</td></tr><tr><td>完成率</td><td>80%</td></tr></table>\" />\n```\n\n## 交互用法\n\n### 链接点击\n\n通过 `onLinkClick` 响应链接点击,事件中的 `href` 为链接地址。\n\n```tsx\n<RichText\n content='<p><a href=\"https://example.com\">查看详情</a></p>'\n onLinkClick={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n```\n\n## 平台与资源说明\n\n音视频默认过滤。浏览器宿主注册 daisu-ui/web 的 registerDaisuWebComponents 并设置 mediaMode=\"browser\" 才启用 HTML5 播放;Flutter 未提供对应后端。播放器支持播放、暂停和定位,关闭/卸载时释放资源。\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| baseUrl | HTTP(S) 基址,只补全图片资源,不改 href | `string` | — |\n| allowDataImage | 允许不超过 64 KiB 的 PNG/JPEG/GIF/WebP Base64 图片;不接受 SVG,不自动预览 | `boolean` | `false` |\n| enableAnchor | 开启目录与原生锚点查询 | `boolean` | `false` |\n| tagStyle | Record<string,string>;默认样式→tagStyle→classStyles→HTML style;不直接使用页面同名 class | `Record<string,string>` | — |\n| classStyles | Record<string,string>;默认样式→tagStyle→classStyles→HTML style;不直接使用页面同名 class | `Record<string,string>` | — |\n| mediaMode | none 过滤音视频;browser 使用已注册的 daisu-ui/web 浏览器播放器 | `'none'\\|'browser'` | `'none'` |\n| content | HTML 字符串;为空、过滤后为空、解析失败显示 children | `string` | `''` |\n| selectable | 映射原生 text-selection;选择体验依目标平台 | `boolean` | `false` |\n| previewImage | 已加载的普通图片点击自动预览;链接图片只触发 linkClick | `boolean` | `true` |\n| loadingImage | 加载/失败占位图片;占位失败退回文字,不重复触发资源错误 | `string` | — |\n| errorImage | 加载/失败占位图片;占位失败退回文字,不重复触发资源错误 | `string` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点类名与 CSSProperties | `string` | `''` |\n| style | 根节点类名与 CSSProperties | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onMediaPlay | 对应操作发生时触发 | (event:RichTextMediaEvent)=>void |\n| onMediaPause | 对应操作发生时触发 | (event:RichTextMediaEvent)=>void |\n| onMediaEnded | 对应操作发生时触发 | (event:RichTextMediaEvent)=>void |\n| onMediaTimeUpdate | 对应操作发生时触发 | (event:RichTextMediaTimeUpdate)=>void |\n| onLoad | 对应操作发生时触发 | (event:{imageCount:number})=>void |\n| onError | 发生错误时触发 | (error:RichTextError)=>void |\n| onLinkClick | 对应操作发生时触发 | (event:{href:string})=>void |\n| onImageClick | 对应操作发生时触发 | (event:{src:string;index:number})=>void |\n| onImageLoad | 对应操作发生时触发 | (event:{src:string;index:number;width:number;height:number})=>void |\n| onScrollToAnchor | 接入实际父滚动容器,参数 {id,rect,offset,duration},可返回 Promise | (target:{id:string;rect:RichTextRect;offset:number;duration:number})=>void\\|Promise<void> |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| playMedia | 调用实例方法 | (id:string)=>boolean |\n| pauseMedia | 调用实例方法 | (id?:string)=>boolean |\n| seekMedia | 调用实例方法 | (id:string,seconds:number)=>boolean |\n| getText | 调用实例方法 | ()=>string |\n| getHeadings | 调用实例方法 | ()=>RichTextHeading[] |\n| getAnchorRect | 调用实例方法 | (id:string)=>Promise<RichTextRect> |\n| scrollToAnchor | 调用实例方法 | (id:string,options?:{offset?:number;duration?:number})=>Promise<void> |\n\n## 数据类型\n\n```tsx\nexport type RichTextMediaEvent = {\n id: string;\n type: RichTextMediaType;\n src: string;\n};\n\nexport type RichTextMediaTimeUpdate = RichTextMediaEvent & {\n currentTime: number;\n duration: number;\n};\n\nexport type RichTextError = {\n source: 'parse' | 'image' | 'audio' | 'video';\n message?: string;\n code?: string;\n src?: string;\n index?: number;\n};\n\nexport type RichTextRect = {\n top: number;\n left: number;\n width: number;\n height: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-rich-text-color` | 当前组件 |\n| `--cso-ui-rich-text-font-size` | 当前组件 |\n| `--cso-ui-rich-text-image-state-bg` | 当前组件 |\n| `--cso-ui-rich-text-image-state-color` | 当前组件 |\n| `--cso-ui-rich-text-line-height` | 当前组件 |\n| `--cso-ui-rich-text-video-height` | 当前组件 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[RichText 组件源码](./sources/rich-text/RichText.tsx.txt) · [示例源码](./sources/rich-text/demo.tsx.txt) · [文档源码](./sources/rich-text/docs.md.txt)\n","demoSource":"import {RichTextMediaExample} from './rich-text-media.js';\nimport {useInitData,useRef,useState} from '@lynx-js/react';\nimport type {NodesRef} from '@lynx-js/types';\nimport { Button, ConfigProvider, RichText } from 'daisu-ui';\nimport type { RichTextHeading, RichTextRef } from 'daisu-ui';\nimport {DemoGroup,ExampleBlock} from './shared.js';\nimport {editorExamples,invitation,invitationStyles,journal,journalStyles,lake,letter,longJournal,originalLake} from './rich-text-content.js';\nconst articleStyle={p:'line-height:1.95;margin:0 0 16px;',th:'text-align:left;',td:'font-size:13px;'};\nexport function RichTextExample(){\n const init=useInitData() as unknown;\n const browser=!!init&&typeof init==='object'&&'browserMedia' in init&&init.browserMedia===true;\n const[content,setContent]=useState(letter),[messages,setMessages]=useState<Record<string,string>>({}),[dark,setDark]=useState(false),[editor,setEditor]=useState(0),[expanded,setExpanded]=useState(false),[headings,setHeadings]=useState<RichTextHeading[]>([]);\n const article=useRef<RichTextRef>(null),scroll=useRef<NodesRef|null>(null),longSection=useRef<NodesRef|null>(null),top=useRef(0);\n const measure=(node:NodesRef)=>new Promise<{top:number}>((resolve,reject)=>node.invoke({method:'boundingClientRect',success:v=>resolve(v as {top:number}),fail:()=>reject(new Error('无法测量滚动位置'))}).exec());\n const scrollToRect=async(rect:{top:number},offset:number)=>{'background only';const node=scroll.current;if(!node)throw new Error('滚动容器已关闭');const bounds=await measure(node),next=Math.max(0,top.current+rect.top-bounds.top-offset);await new Promise<void>((resolve,reject)=>node.invoke({method:'scrollTo',params:{offset:next,index:0,smooth:false},success:()=>resolve(),fail:()=>reject(new Error('滚动失败'))}).exec());};\n const collapse=async()=>{'background only';const section=longSection.current;if(!section)return;try{const rect=await measure(section);setExpanded(false);setHeadings([]);await scrollToRect(rect,0);}catch{setExpanded(false);}};\n const feedback=(key:string,text:string)=>{'background only';setMessages(old=>({...old,[key]:text}));};\n const note=(key:string)=>messages[key]?<text className=\"demo-rich-feedback\">{messages[key]}</text>:null;\n const jump=async(id:string)=>{'background only';try{await article.current!.scrollToAnchor(id,{offset:16,duration:0});}catch{feedback('anchor','章节位置已变化,请重新选择。');}};\n return <scroll-view ref={scroll} className=\"ui-demo-component-scroll\" scroll-orientation=\"vertical\" scroll-y bindscroll={e=>{'background only';top.current=e.detail.scrollTop;}}><view className=\"ui-demo-component-content demo-rich-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础图文 · 周末出走\"><view className=\"demo-rich-article\"><RichText content={journal} classStyles={journalStyles} tagStyle={articleStyle} selectable onLinkClick={()=>{'background only';feedback('article','行前准备:舒适的鞋、饮水、轻食和随身垃圾袋。');}}/></view>{note('article')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"内容更新与空状态\"><view className=\"demo-rich-actions\"><Button size=\"small\" label=\"更新来信\" onTap={()=>{'background only';setContent('<p><strong>计划已更新</strong></p><p>出发时间改为周六上午九点。别忘了带上水和一件轻外套。</p>');}}/><Button size=\"small\" label=\"清空内容\" onTap={()=>{'background only';setContent('');}}/><Button size=\"small\" label=\"恢复来信\" onTap={()=>{'background only';setContent(letter);}}/></view><view className=\"demo-rich-dynamic\"><RichText content={content}><text className=\"demo-rich-empty\">还没有新的来信,去看看窗外吧。</text></RichText></view></ExampleBlock>\n <ExampleBlock title=\"图片加载失败与占位\"><RichText content={'<img src=\"\" alt=\"这张照片暂时无法加载\" width=\"100%\" height=\"80\">'}/><text className=\"demo-rich-hint\">照片暂不可用时,用自定义占位图承接。</text></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"图片预览\"><view className=\"demo-rich-photo\"><RichText content={`<img src=\"${lake}\" original-src=\"${originalLake}\" alt=\"点击查看山湖大图\" width=\"100%\"><p class=\"journal-note\">轻触照片,看看远处的山。</p>`} classStyles={journalStyles} onImageLoad={e=>{'background only';feedback('size',`照片尺寸:${e.width} × ${e.height},轻触预览原图。`);}}/></view>{messages.size?<text className=\"demo-rich-hint\">{messages.size}</text>:null}</ExampleBlock>\n <ExampleBlock title=\"链接点击\"><RichText content={'<p>一次轻装出行,从一份简单的<a href=\"/journal/gear\">行前准备清单</a>开始。沿途看到喜欢的风景,也记得<a href=\"/journal/share\">分享给同行的人</a>。</p>'} onLinkClick={({href})=>{'background only';feedback('link',href==='/journal/gear'?'清单已打开:带上饮水和轻外套,轻装出发。':'这段旅途,值得分享给你在意的人。');}}/>{note('link')}</ExampleBlock>\n <ExampleBlock title=\"图片链接\"><view className=\"demo-rich-photo\"><RichText content={`<a href=\"/journal/story\"><img src=\"${lake}\" alt=\"阅读山野手记\" width=\"100%\"></a>`} onLinkClick={()=>{'background only';feedback('photo','你打开了「山野手记」的阅读入口。');}}/></view><text className=\"demo-rich-hint\">轻触照片,打开阅读入口。</text>{note('photo')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"标签与 class 样式 · 一封邀请函\"><view className=\"demo-rich-invitation\"><RichText content={invitation} classStyles={invitationStyles} tagStyle={{p:'text-align:center;line-height:1.9;',h2:'text-align:center;'}} onLinkClick={()=>{'background only';feedback('invitation','邀请已收下,周末见!');}}/></view>{note('invitation')}</ExampleBlock>\n <ExampleBlock title=\"主题与文字样式\"><view className=\"demo-rich-actions\"><Button label={dark?'切换浅色':'切换深色'} size=\"small\" onTap={()=>{'background only';setDark(v=>!v);}}/></view><ConfigProvider theme={dark?'dark':'light'} themeVars={{text:dark?'#f7f8fa':'#1d1f29',surfaceMuted:dark?'#272b3b':'#f2f3f5','--cso-ui-rich-text-link-color':'#12b886'}}><view className=\"demo-rich-theme\"><RichText content={'<h3>山野里的晚安</h3><p>天色慢慢暗下来,最后一束光落在山尖。<strong>愿你今晚,也有一个好梦。</strong></p><p><a href=\"/journal/story\">再读一段旅途故事 →</a></p>'} style={{'--cso-ui-rich-text-font-size':'16px','--cso-ui-rich-text-line-height':'1.9'} as never} onLinkClick={()=>{'background only';feedback('theme','愿这段故事,陪你度过一个安静的夜晚。');}}/></view></ConfigProvider>{note('theme')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\"><ExampleBlock title=\"有序与嵌套列表\"><RichText content=\"<ol><li>沿湖出发,先让脚步慢下来。</li><li>找一处树荫,打开野餐篮。<ul><li>分享水果与面包</li><li>收好包装,不留下痕迹</li></ul></li><li>在日落前返程,留一点期待给下次。</li></ol>\"/></ExampleBlock>\n <ExampleBlock title=\"宽表格横向滚动\"><text className=\"demo-rich-hint\">向左右滑动,查看完整行程。</text><RichText content={'<table style=\"width:560px\"><colgroup><col width=\"89\"><col width=\"125\"><col width=\"149\"><col width=\"197\"></colgroup><tr><th>时间</th><th>地点</th><th>安排</th><th>随身物品</th></tr><tr><td>09:00</td><td>湖畔步道</td><td>慢走与拍照</td><td>水、轻便外套</td></tr><tr><td>12:00</td><td>林间草地</td><td>野餐与阅读</td><td>野餐垫、一本书</td></tr><tr><td>16:00</td><td>步道入口</td><td>集合返程</td><td>随身垃圾袋</td></tr></table>'}/></ExampleBlock>\n <ExampleBlock title=\"列宽与合并单元格\"><RichText tagStyle={{th:'text-align:left;'}} content={'<table><colgroup><col width=\"20%\"><col width=\"25%\"><col width=\"55%\"></colgroup><tr><th>行程</th><th colspan=\"2\">周末慢游计划</th></tr><tr><td rowspan=\"2\">上午</td><td>09:00</td><td>湖畔集合</td></tr><tr><td>10:00</td><td><a href=\"/journal/gear\">林间轻徒步</a></td></tr><tr><td>下午</td><td>14:00</td><td>草地阅读会</td></tr></table>'} onLinkClick={()=>{'background only';feedback('merged','轻徒步准备:舒适的鞋、饮水和一件外套。');}}/>{note('merged')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"编辑器内容\"><view className=\"demo-rich-actions\">{editorExamples.map((e,i)=><Button key={e.name} label={e.name} size=\"small\" variant={editor===i?'solid':'plain'} onTap={()=>{'background only';setEditor(i);}}/>)}</view><text className=\"demo-rich-hint\">{editorExamples[editor]!.note}</text><view className=\"demo-rich-editor\"><RichText content={editorExamples[editor]!.content} onLinkClick={()=>{'background only';feedback('editor','清单已备好,下一站,去见山。');}}/></view>{note('editor')}</ExampleBlock>\n <ExampleBlock title=\"音视频 · 有声旅行手记\"><RichTextMediaExample browser={browser} scrollToAnchor={scrollToRect}/></ExampleBlock>\n <ExampleBlock title=\"长文章 · 完整旅行手记\"><view ref={longSection}><text className=\"demo-rich-hint\">从晨光到归途,六段值得慢慢读的时光。</text><Button className=\"demo-rich-toggle\" size=\"small\" label={expanded?'收起手记':'展开完整手记'} onTap={()=>{'background only';if(expanded)void collapse();else setExpanded(true);}}/>{expanded?<view className=\"demo-rich-long\"><view className=\"demo-rich-directory\"><text className=\"demo-rich-hint\">选择章节,跳到你想读的地方。</text><view className=\"demo-rich-actions\">{headings.filter(h=>h.level===3).map(h=><Button key={h.id} label={h.text} size=\"small\" onTap={()=>jump(h.id)}/>)}</view></view>{note('anchor')}<RichText ref={article} content={longJournal} classStyles={journalStyles} tagStyle={articleStyle} enableAnchor onLoad={()=>{'background only';setHeadings(article.current?.getHeadings()??[]);}} onLinkClick={({href})=>{'background only';if(href.startsWith('#'))void jump(href.slice(1));}} onScrollToAnchor={({rect,offset})=>{'background only';return scrollToRect(rect,offset);}}/><Button className=\"demo-rich-toggle\" size=\"small\" label=\"收起手记,回到开头\" onTap={()=>{'background only';void collapse();}}/></view>:null}</view></ExampleBlock></DemoGroup><view className=\"ui-demo-bottom-space\"/></view></scroll-view>;\n}\n","props":[{"name":"baseUrl","type":"string","optional":true,"description":"HTTP(S) 基址,只补全图片资源,不改 href"},{"name":"allowDataImage","type":"boolean","optional":true,"description":"允许不超过 64 KiB 的 PNG/JPEG/GIF/WebP Base64 图片;不接受 SVG,不自动预览","defaultValue":"false","values":[false,true]},{"name":"enableAnchor","type":"boolean","optional":true,"description":"开启目录与原生锚点查询","defaultValue":"false","values":[false,true]},{"name":"tagStyle","type":"Record<string,string>","optional":true,"description":"Record<string,string>;默认样式→tagStyle→classStyles→HTML style;不直接使用页面同名 class"},{"name":"classStyles","type":"Record<string,string>","optional":true,"description":"Record<string,string>;默认样式→tagStyle→classStyles→HTML style;不直接使用页面同名 class"},{"name":"mediaMode","type":"'none'|'browser'","optional":true,"description":"none 过滤音视频;browser 使用已注册的 daisu-ui/web 浏览器播放器","defaultValue":"'none'","values":["none","browser"]},{"name":"content","type":"string","optional":true,"description":"HTML 字符串;为空、过滤后为空、解析失败显示 children","defaultValue":"''"},{"name":"selectable","type":"boolean","optional":true,"description":"映射原生 text-selection;选择体验依目标平台","defaultValue":"false","values":[false,true]},{"name":"previewImage","type":"boolean","optional":true,"description":"已加载的普通图片点击自动预览;链接图片只触发 linkClick","defaultValue":"true","values":[false,true]},{"name":"loadingImage","type":"string","optional":true,"description":"加载/失败占位图片;占位失败退回文字,不重复触发资源错误"},{"name":"errorImage","type":"string","optional":true,"description":"加载/失败占位图片;占位失败退回文字,不重复触发资源错误"},{"name":"className","type":"string","optional":true,"description":"根节点类名与 CSSProperties","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点类名与 CSSProperties"}],"events":[{"name":"onMediaPlay","type":"(event:RichTextMediaEvent)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onMediaPause","type":"(event:RichTextMediaEvent)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onMediaEnded","type":"(event:RichTextMediaEvent)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onMediaTimeUpdate","type":"(event:RichTextMediaTimeUpdate)=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onLoad","type":"(event:{imageCount:number})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onError","type":"(error:RichTextError)=>void","optional":true,"description":"发生错误时触发"},{"name":"onLinkClick","type":"(event:{href:string})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onImageClick","type":"(event:{src:string;index:number})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onImageLoad","type":"(event:{src:string;index:number;width:number;height:number})=>void","optional":true,"description":"对应操作发生时触发"},{"name":"onScrollToAnchor","type":"(target:{id:string;rect:RichTextRect;offset:number;duration:number})=>void|Promise<void>","optional":true,"description":"接入实际父滚动容器,参数 {id,rect,offset,duration},可返回 Promise"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"playMedia","description":"调用实例方法","type":"(id:string)=>boolean"},{"name":"pauseMedia","description":"调用实例方法","type":"(id?:string)=>boolean"},{"name":"seekMedia","description":"调用实例方法","type":"(id:string,seconds:number)=>boolean"},{"name":"getText","description":"调用实例方法","type":"()=>string"},{"name":"getHeadings","description":"调用实例方法","type":"()=>RichTextHeading[]"},{"name":"getAnchorRect","description":"调用实例方法","type":"(id:string)=>Promise<RichTextRect>"},{"name":"scrollToAnchor","description":"调用实例方法","type":"(id:string,options?:{offset?:number;duration?:number})=>Promise<void>"}],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-rich-text-color","defaultValue":"var(--cso-ui-text)","description":""},{"name":"--cso-ui-rich-text-font-size","defaultValue":"14px","description":""},{"name":"--cso-ui-rich-text-image-state-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-rich-text-image-state-color","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-rich-text-line-height","defaultValue":"1.7","description":""},{"name":"--cso-ui-rich-text-video-height","defaultValue":"225px","description":""},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","展示 HTML"],"title":"展示 HTML","section":"组件类型","description":"通过 `content` 传入 HTML 字符串,组件展示其中的段落、标题等内容。","language":"tsx","code":"<RichText content=\"<h2>文章标题</h2><p>这里是文章正文。</p>\" />\n","blocks":[{"language":"tsx","code":"<RichText content=\"<h2>文章标题</h2><p>这里是文章正文。</p>\" />\n"}]},{"name":"demo-2","aliases":["demo-2","表格与列表"],"title":"表格与列表","section":"内容形态","description":"`content` 支持表格和列表标签,可在同一段富文本中组合展示。","language":"tsx","code":"<RichText content=\"<ul><li>项目一</li><li>项目二</li></ul><table><tr><td>名称</td><td>数值</td></tr><tr><td>完成率</td><td>80%</td></tr></table>\" />\n","blocks":[{"language":"tsx","code":"<RichText content=\"<ul><li>项目一</li><li>项目二</li></ul><table><tr><td>名称</td><td>数值</td></tr><tr><td>完成率</td><td>80%</td></tr></table>\" />\n"}]},{"name":"demo-3","aliases":["demo-3","链接点击"],"title":"链接点击","section":"交互用法","description":"通过 `onLinkClick` 响应链接点击,事件中的 `href` 为链接地址。","language":"tsx","code":"<RichText\n content='<p><a href=\"https://example.com\">查看详情</a></p>'\n onLinkClick={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<RichText\n content='<p><a href=\"https://example.com\">查看详情</a></p>'\n onLinkClick={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"RootPortal","id":"root-portal","label":"Root Portal 根节点传送门","category":"基础","categoryId":"basic","kind":"component","description":"根节点传送门将弹层内容挂载到页面根部,帮助浮层脱离局部裁剪和变换容器。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/RootPortal.tsx","docPath":"docs/ui/components/root-portal.md","doc":"# Root Portal 根节点传送门\n\n根节点传送门将弹层内容挂载到页面根部,帮助浮层脱离局部裁剪和变换容器。\n\n```tsx\nimport { RootPortal, RootPortalHost } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 配置挂载宿主\n\n在页面根部放置 `RootPortalHost`,使用 `RootPortal` 将浮层挂载到该宿主。\n\n```tsx\n<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n```\n\n## 组合用法\n\n### 与主题配合\n\n将 `RootPortalHost` 放在 `ConfigProvider` 内,使根节点浮层获得相同主题配置。\n\n```tsx\nimport { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n```\n\n## Attributes 属性\n\n### RootPortal\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n\n### RootPortalHost\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| RootPortal.children | 自定义内容 | ReactNode |\n| RootPortalHost.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RootPortal 组件源码](./sources/root-portal/RootPortal.tsx.txt) · [RootPortalHost 组件源码](./sources/root-portal/RootPortal.tsx.txt) · [示例源码](./sources/root-portal/demo.tsx.txt) · [文档源码](./sources/root-portal/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, SelectPicker, RootPortal } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst categories = ['男装', '奢侈品', '女装', '鞋靴', '内衣配饰', '箱包', '美妆护肤', '个性清洁', '钟表珠宝', '手机', '数码', '电脑办公'];\n\nconst categoryOptions = categories.map(label => ({ value: label, label }));\n\nexport function RootPortalExample() {\n const [basic, setBasic] = useState(false);\n const [picker, setPicker] = useState(false);\n const [selected, setSelected] = useState<string[]>([]);\n return <view className=\"demo-root-portal-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-root-portal-trigger\"><Button label=\"显示基本弹窗\" onTap={() => { 'background only'; setBasic(true); }} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"与弹层组件配合使用\" noPadding><Cell title=\"选择商品分类\" value={selected.join('、')} arrow onTap={() => { 'background only'; setPicker(true); }} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"使用注意\"><ExampleBlock title=\"适用场景\"><view className=\"demo-root-portal-tips\"><text>适用于弹窗、弹出层等 fixed 定位容易失效的场景。</text><text>建议只在需要脱离父层级或避免被 transform、overflow 影响时开启。</text></view></ExampleBlock></DemoGroup>\n {basic ? <RootPortal><view className=\"ui-demo-page demo-root-portal-modal\"><view className=\"demo-root-portal-modal-content\"><text className=\"demo-root-portal-modal-title\">基本弹窗</text><text className=\"demo-root-portal-modal-text\">这是一个使用 root-portal 的基本弹窗示例。</text><Button label=\"关闭\" onTap={() => { 'background only'; setBasic(false); }} /></view></view></RootPortal> : null}\n <SelectPicker rootPortal visible={picker} onVisibleChange={setPicker} value={selected} title=\"选择商品分类\" columns={categoryOptions} className=\"ui-demo-page\" onConfirm={({ value }) => { 'background only'; setSelected(Array.isArray(value) ? value.map(String) : [String(value)]); }} />\n </view>;\n}\n","props":[],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","配置挂载宿主"],"title":"配置挂载宿主","section":"基础用法","description":"在页面根部放置 `RootPortalHost`,使用 `RootPortal` 将浮层挂载到该宿主。","language":"tsx","code":"<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n","blocks":[{"language":"tsx","code":"<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n"}]},{"name":"demo-2","aliases":["demo-2","与主题配合"],"title":"与主题配合","section":"组合用法","description":"将 `RootPortalHost` 放在 `ConfigProvider` 内,使根节点浮层获得相同主题配置。","language":"tsx","code":"import { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n","blocks":[{"language":"tsx","code":"import { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n"}]}],"allowUnknownProps":false},{"name":"RootPortalHost","id":"root-portal","label":"Root Portal 根节点传送门","category":"基础","categoryId":"basic","kind":"component","description":"根节点传送门将弹层内容挂载到页面根部,帮助浮层脱离局部裁剪和变换容器。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/RootPortal.tsx","docPath":"docs/ui/components/root-portal.md","doc":"# Root Portal 根节点传送门\n\n根节点传送门将弹层内容挂载到页面根部,帮助浮层脱离局部裁剪和变换容器。\n\n```tsx\nimport { RootPortal, RootPortalHost } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 配置挂载宿主\n\n在页面根部放置 `RootPortalHost`,使用 `RootPortal` 将浮层挂载到该宿主。\n\n```tsx\n<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n```\n\n## 组合用法\n\n### 与主题配合\n\n将 `RootPortalHost` 放在 `ConfigProvider` 内,使根节点浮层获得相同主题配置。\n\n```tsx\nimport { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n```\n\n## Attributes 属性\n\n### RootPortal\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n\n### RootPortalHost\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| RootPortal.children | 自定义内容 | ReactNode |\n| RootPortalHost.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RootPortal 组件源码](./sources/root-portal/RootPortal.tsx.txt) · [RootPortalHost 组件源码](./sources/root-portal/RootPortal.tsx.txt) · [示例源码](./sources/root-portal/demo.tsx.txt) · [文档源码](./sources/root-portal/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, SelectPicker, RootPortal } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst categories = ['男装', '奢侈品', '女装', '鞋靴', '内衣配饰', '箱包', '美妆护肤', '个性清洁', '钟表珠宝', '手机', '数码', '电脑办公'];\n\nconst categoryOptions = categories.map(label => ({ value: label, label }));\n\nexport function RootPortalExample() {\n const [basic, setBasic] = useState(false);\n const [picker, setPicker] = useState(false);\n const [selected, setSelected] = useState<string[]>([]);\n return <view className=\"demo-root-portal-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-root-portal-trigger\"><Button label=\"显示基本弹窗\" onTap={() => { 'background only'; setBasic(true); }} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"与弹层组件配合使用\" noPadding><Cell title=\"选择商品分类\" value={selected.join('、')} arrow onTap={() => { 'background only'; setPicker(true); }} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"使用注意\"><ExampleBlock title=\"适用场景\"><view className=\"demo-root-portal-tips\"><text>适用于弹窗、弹出层等 fixed 定位容易失效的场景。</text><text>建议只在需要脱离父层级或避免被 transform、overflow 影响时开启。</text></view></ExampleBlock></DemoGroup>\n {basic ? <RootPortal><view className=\"ui-demo-page demo-root-portal-modal\"><view className=\"demo-root-portal-modal-content\"><text className=\"demo-root-portal-modal-title\">基本弹窗</text><text className=\"demo-root-portal-modal-text\">这是一个使用 root-portal 的基本弹窗示例。</text><Button label=\"关闭\" onTap={() => { 'background only'; setBasic(false); }} /></view></view></RootPortal> : null}\n <SelectPicker rootPortal visible={picker} onVisibleChange={setPicker} value={selected} title=\"选择商品分类\" columns={categoryOptions} className=\"ui-demo-page\" onConfirm={({ value }) => { 'background only'; setSelected(Array.isArray(value) ? value.map(String) : [String(value)]); }} />\n </view>;\n}\n","props":[],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","配置挂载宿主"],"title":"配置挂载宿主","section":"基础用法","description":"在页面根部放置 `RootPortalHost`,使用 `RootPortal` 将浮层挂载到该宿主。","language":"tsx","code":"<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n","blocks":[{"language":"tsx","code":"<RootPortalHost>\n <text>页面内容</text>\n <RootPortal>\n <view style={{ position: 'fixed', top: '80px', right: '16px' }}>\n <text>根节点浮层</text>\n </view>\n </RootPortal>\n</RootPortalHost>\n"}]},{"name":"demo-2","aliases":["demo-2","与主题配合"],"title":"与主题配合","section":"组合用法","description":"将 `RootPortalHost` 放在 `ConfigProvider` 内,使根节点浮层获得相同主题配置。","language":"tsx","code":"import { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n","blocks":[{"language":"tsx","code":"import { ConfigProvider, Button } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n <RootPortalHost>\n <Button label=\"页面操作\" />\n </RootPortalHost>\n</ConfigProvider>\n"}]}],"allowUnknownProps":false},{"name":"routePath","id":"route-path","label":"routePath","category":"公共 API","categoryId":"api","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router/location","source":"packages/daisu-ui/src/router/location.ts","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of a string."},{"name":"charAt","type":"string","optional":false,"description":"Returns the character at the specified index."},{"name":"charCodeAt","type":"number","optional":false,"description":"Returns the Unicode value of the character at the specified location."},{"name":"concat","type":"string","optional":false,"description":"Returns a string that contains the concatenation of two or more strings."},{"name":"indexOf","type":"number","optional":false,"description":"Returns the position of the first occurrence of a substring, or -1 if it is not present."},{"name":"lastIndexOf","type":"number","optional":false,"description":"Returns the last occurrence of a substring in the string, or -1 if it is not present."},{"name":"localeCompare","type":"number","optional":false,"description":"Determines whether two strings are equivalent in the current locale.\nDetermines whether two strings are equivalent in the current or specified locale."},{"name":"match","type":"RegExpMatchArray | null","optional":false,"description":"Matches a string with a regular expression, and returns an array containing the results of that search.\nMatches a string or an object that supports being matched against, and returns an array\ncontaining the results of that search, or null if no matches are found."},{"name":"replace","type":"string","optional":false,"description":"Replaces text in a string, using a regular expression or search string.\nPasses a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.\nReplaces text in a string, using an object that supports replacement within a string."},{"name":"search","type":"number","optional":false,"description":"Finds the first substring match in a regular expression search."},{"name":"slice","type":"string","optional":false,"description":"Returns a section of a string."},{"name":"split","type":"string[]","optional":false,"description":"Split a string into substrings using the specified separator and return them as an array."},{"name":"substring","type":"string","optional":false,"description":"Returns the substring at the specified location within a String object."},{"name":"toLowerCase","type":"string","optional":false,"description":"Converts all the alphabetic characters in a string to lowercase."},{"name":"toLocaleLowerCase","type":"string","optional":false,"description":"Converts all alphabetic characters to lowercase, taking into account the host environment's current locale."},{"name":"toUpperCase","type":"string","optional":false,"description":"Converts all the alphabetic characters in a string to uppercase."},{"name":"toLocaleUpperCase","type":"string","optional":false,"description":"Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale."},{"name":"trim","type":"string","optional":false,"description":"Removes the leading and trailing white space and line terminator characters from a string."},{"name":"length","type":"number","optional":false,"description":"Returns the length of a String object."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"substr","type":"string","optional":false,"description":"Gets a substring beginning at the specified location and having the specified length."},{"name":"valueOf","type":"string","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"codePointAt","type":"number | undefined","optional":false,"description":"Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\nvalue of the UTF-16 encoded code point starting at the string element at position pos in\nthe String resulting from converting this object to a String.\nIf there is no element at that position, the result is undefined.\nIf a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos."},{"name":"includes","type":"boolean","optional":false,"description":"Returns true if searchString appears as a substring of the result of converting this\nobject to a String, at one or more positions that are\ngreater than or equal to position; otherwise, returns false."},{"name":"endsWith","type":"boolean","optional":false,"description":"Returns true if the sequence of elements of searchString converted to a String is the\nsame as the corresponding elements of this object (converted to a String) starting at\nendPosition – length(this). Otherwise returns false."},{"name":"normalize","type":"string","optional":false,"description":"Returns the String value result of normalizing the string into the normalization form\nnamed by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms."},{"name":"repeat","type":"string","optional":false,"description":"Returns a String value that is made from count copies appended together. If count is 0,\nthe empty string is returned."},{"name":"startsWith","type":"boolean","optional":false,"description":"Returns true if the sequence of elements of searchString converted to a String is the\nsame as the corresponding elements of this object (converted to a String) starting at\nposition. Otherwise returns false."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"anchor","type":"string","optional":false,"description":"Returns an `<a>` HTML anchor element and sets the name attribute to the text value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"big","type":"string","optional":false,"description":"Returns a `<big>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"blink","type":"string","optional":false,"description":"Returns a `<blink>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"bold","type":"string","optional":false,"description":"Returns a `<b>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"fixed","type":"string","optional":false,"description":"Returns a `<tt>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"fontcolor","type":"string","optional":false,"description":"Returns a `<font>` HTML element and sets the color attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility A legacy feature for browser compatibility","name":"fontsize","type":"string","optional":false,"description":"Returns a `<font>` HTML element and sets the size attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"italics","type":"string","optional":false,"description":"Returns an `<i>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"link","type":"string","optional":false,"description":"Returns an `<a>` HTML element and sets the href attribute value"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"small","type":"string","optional":false,"description":"Returns a `<small>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"strike","type":"string","optional":false,"description":"Returns a `<strike>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"sub","type":"string","optional":false,"description":"Returns a `<sub>` HTML element"},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility","name":"sup","type":"string","optional":false,"description":"Returns a `<sup>` HTML element"},{"name":"padStart","type":"string","optional":false,"description":"Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.\nThe padding is applied from the start (left) of the current string."},{"name":"padEnd","type":"string","optional":false,"description":"Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.\nThe padding is applied from the end (right) of the current string."},{"name":"trimEnd","type":"string","optional":false,"description":"Removes the trailing white space and line terminator characters from a string."},{"name":"trimStart","type":"string","optional":false,"description":"Removes the leading white space and line terminator characters from a string."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility. Use `trimStart` instead","name":"trimLeft","type":"string","optional":false,"description":"Removes the leading white space and line terminator characters from a string."},{"deprecated":true,"deprecationMessage":"A legacy feature for browser compatibility. Use `trimEnd` instead","name":"trimRight","type":"string","optional":false,"description":"Removes the trailing white space and line terminator characters from a string."},{"name":"matchAll","type":"RegExpStringIterator<RegExpExecArray>","optional":false,"description":"Matches a string with a regular expression, and returns an iterable of matches\ncontaining the results of that search."},{"name":"replaceAll","type":"string","optional":false,"description":"Replace all instances of a substring in a string, using a regular expression or search string."},{"name":"at","type":"string | undefined","optional":false,"description":"Returns a new String consisting of the single UTF-16 code unit located at the specified index."},{"name":"__@iterator@1879","type":"StringIterator<string>","optional":false,"description":"Iterator"}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"RouterProvider","id":"router-provider","label":"RouterProvider","category":"公共 API","categoryId":"api","kind":"component","description":"RouterProvider 公开 API","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[{"name":"router","type":"Router<R, TTree>","optional":false,"description":""}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":""}],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"RouterView","id":"router","label":"Router 路由","category":"导航","categoryId":"navigation","kind":"component","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/RouterView.tsx","docPath":"docs/ui/components/router.md","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Button } from 'daisu-ui';\nimport { useRoute, useRouterSnapshot } from 'daisu-ui/router';\nimport type { AppRoute } from '../../../app/router.js';\nimport { useAppRouter } from '../../../app/router.js';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function RouterExample() {\n const router = useAppRouter();\n const route = useRoute<AppRoute>();\n const snapshot = useRouterSnapshot(router);\n const [blockBack, setBlockBack] = useState(false);\n const [notice, setNotice] = useState('');\n useEffect(() => router.beforeEach(navigation => {\n 'background only';\n if (navigation.from === route && blockBack && (navigation.action === 'back' || navigation.source === 'history')) {\n setNotice('已阻止返回,请先关闭导航守卫');\n return false;\n }\n }), [router, route, blockBack]);\n return <view>\n <DemoGroup title=\"当前路由\">\n <ExampleBlock title=\"页面与页面栈\">\n <text className=\"catalog-card-copy\">{router.href(route)}</text>\n <text className=\"catalog-card-copy\">{`页面栈:${snapshot.entries.length} 页`}</text>\n {snapshot.entries.slice(-5).map((entry, index) => <text key={entry.key} className=\"catalog-card-copy\">\n {`${Math.max(0, snapshot.entries.length - 5) + index + 1}. ${router.href(entry.route)}${entry.route === route ? '(本页面)' : ''}`}\n </text>)}\n <text className=\"catalog-card-copy\">TanStack Router 管理路由匹配与导航;H5 地址同步,刷新恢复当前页面。</text>\n </ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"导航方法\">\n <ExampleBlock title=\"push:打开组件页\">\n <Button label=\"打开 Button 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'button' } }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"push:保留当前页状态\">\n <Button label=\"再打开一个 Router 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'router' } }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"replace:替换当前页\" description=\"只替换栈顶,下层已有的 Router 页面仍然可以返回。\">\n <Button label=\"替换为 Cell 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'cell' }, replace: true }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"back:返回上一页\">\n <Button label=\"返回上一页\" onTap={() => { 'background only'; void router.back(); }} />\n </ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"导航守卫\">\n <ExampleBlock title=\"同时拦截按钮返回与浏览器后退\">\n <Button label={blockBack ? '关闭返回拦截' : '开启返回拦截'} onTap={() => { 'background only'; setBlockBack(value => !value); setNotice(''); }} />\n {notice ? <text className=\"catalog-card-copy\">{notice}</text> : null}\n </ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"router","type":"Router<R, TTree>","optional":false,"description":"页面路由实例","defaultValue":"必填"},{"name":"controllerRef","type":"MutableRefObject<RouterViewController | null>","optional":true,"description":"页面栈控制器引用"},{"name":"canSwipeBack","type":"boolean","optional":true,"description":"判断当前页面是否允许侧滑返回","defaultValue":"() => true"},{"name":"sceneClassName","type":"string","optional":true,"description":"页面场景类名生成函数","defaultValue":"() => ''"},{"name":"viewportWidth","type":"number","optional":true,"description":"页面可用宽度","defaultValue":"375"},{"name":"platform","type":"string","optional":true,"description":"当前运行平台"},{"name":"systemGestureInsetLeft","type":"number","optional":true,"description":"系统左侧手势区域宽度","defaultValue":"0"}],"events":[{"name":"onExit","type":"void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"renderRoute","type":"ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"RouteScreen","id":"route-screen","label":"RouteScreen","category":"公共 API","categoryId":"api","kind":"component","description":"Render the leaf component registered on the TanStack route tree.","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Row","id":"layout","label":"Layout 布局","category":"基础","categoryId":"basic","kind":"component","description":"栅格布局将一行划分为 24 份,通过 Row 与 Col 组合控制宽度、间隔、偏移和对齐。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Layout.tsx","docPath":"docs/ui/components/layout.md","doc":"# Layout 布局\n\n栅格布局将一行划分为 24 份,通过 Row 与 Col 组合控制宽度、间隔、偏移和对齐。\n\n```tsx\nimport { Row, Col } from 'daisu-ui';\n```\n\n## 布局能力\n\n### 基础分栏\n\n栅格将一行分为 24 份,通过 `Col.span` 设置每列占用的份数。\n\n```tsx\n<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n```\n\n### 间隔与偏移\n\n通过 `Row.gutter` 设置列间距,通过 `Col.offset` 设置左侧偏移份数。\n\n```tsx\n<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n```\n\n### 水平与垂直对齐\n\n通过 `justify` 设置水平排列方式,通过 `align` 设置垂直对齐方式。\n\n```tsx\n<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n```\n\n## Attributes 属性\n\n### Row\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| gutter | 栅格列间隔,单位 px | `number` | `0` |\n| justify | 水平方向排列方式 | `keyof typeof justifyValues` | `'start'` |\n| align | 对齐方式 | `keyof typeof alignValues` | `'top'` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n### Col\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| span | 占用的栅格份数 | `number` | `24` |\n| offset | 相对目标元素的偏移 | `number` | `0` |\n| className | 根节点自定义类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Row.children | 自定义内容 | ReactNode |\n| Col.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Row 组件源码](./sources/layout/Layout.tsx.txt) · [Col 组件源码](./sources/layout/Layout.tsx.txt) · [示例源码](./sources/layout/demo.tsx.txt) · [文档源码](./sources/layout/docs.md.txt)\n","demoSource":"import { Col, Row } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction LayoutCell({ label, tone = 'strong', height = 30 }: { label: string; tone?: 'primary' | 'strong' | 'light'; height?: number }) {\n return <view className={`demo-layout-cell demo-layout-cell-${tone}`} style={{ height: `${height}px` }}><text>{label}</text></view>;\n}\n\nexport function LayoutExample() {\n return <view className=\"demo-layout-page\"><DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"基础用法\">\n <Row><Col><LayoutCell label=\"span: 24\" tone=\"primary\" /></Col></Row>\n {[12, 8, 6].map(span => <Row key={span}>{Array.from({ length: 24 / span }, (_, index) => <Col key={index} span={span}><LayoutCell label={`span: ${span}`} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}\n </ExampleBlock>\n <ExampleBlock title=\"分栏偏移\">\n <Row><Col span={4}><LayoutCell label=\"span: 4\" /></Col><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" tone=\"light\" /></Col></Row>\n <Row><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" /></Col><Col span={8} offset={4}><LayoutCell label=\"span: 8 offset: 4\" tone=\"light\" /></Col></Row>\n </ExampleBlock>\n <ExampleBlock title=\"分栏间隔\"><Row gutter={20}>{[0, 1, 2].map(index => <Col key={index} span={8}><LayoutCell label=\"span: 8\" tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row></ExampleBlock>\n <ExampleBlock title=\"Justify 对齐\">{(['center', 'end', 'space-between', 'space-around'] as const).map(justify => <Row key={justify} justify={justify}>{[0, 1, 2].map(index => <Col key={index} span={6}><LayoutCell label={justify.replace('space-', '')} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}</ExampleBlock>\n <ExampleBlock title=\"Align 对齐\">{(['middle', 'bottom'] as const).map(align => <Row key={align} align={align}>{[60, 30, 50].map((height, index) => <Col key={height} span={8}><LayoutCell label={align} height={height} tone={index % 2 ? 'light' : 'strong'} /></Col>)}</Row>)}</ExampleBlock>\n </DemoGroup></view>;\n}\n","props":[{"name":"gutter","type":"number","optional":true,"description":"栅格列间隔,单位 px","defaultValue":"0"},{"name":"justify","type":"keyof typeof justifyValues","optional":true,"description":"水平方向排列方式","defaultValue":"'start'","values":["center","space-between","space-around","space-evenly","start","end"]},{"name":"align","type":"keyof typeof alignValues","optional":true,"description":"对齐方式","defaultValue":"'top'","values":["bottom","top","middle"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","基础分栏"],"title":"基础分栏","section":"布局能力","description":"栅格将一行分为 24 份,通过 `Col.span` 设置每列占用的份数。","language":"tsx","code":"<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row>\n <Col span={8}>\n <text>左侧</text>\n </Col>\n <Col span={16}>\n <text>右侧</text>\n </Col>\n</Row>\n"}]},{"name":"demo-2","aliases":["demo-2","间隔与偏移"],"title":"间隔与偏移","section":"布局能力","description":"通过 `Row.gutter` 设置列间距,通过 `Col.offset` 设置左侧偏移份数。","language":"tsx","code":"<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row gutter={20}>\n <Col span={8}>\n <text>内容一</text>\n </Col>\n <Col span={8} offset={4}>\n <text>内容二</text>\n </Col>\n</Row>\n"}]},{"name":"demo-3","aliases":["demo-3","水平与垂直对齐"],"title":"水平与垂直对齐","section":"布局能力","description":"通过 `justify` 设置水平排列方式,通过 `align` 设置垂直对齐方式。","language":"tsx","code":"<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n","blocks":[{"language":"tsx","code":"<Row justify=\"space-between\" align=\"middle\">\n <Col span={6}>\n <text>左侧</text>\n </Col>\n <Col span={6}>\n <text>右侧</text>\n </Col>\n</Row>\n"}]}],"allowUnknownProps":false},{"name":"Search","id":"search","label":"Search 搜索框","category":"录入","categoryId":"form","kind":"component","description":"搜索框用于输入关键字并触发搜索,支持清空、取消、聚焦和自定义操作区域。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Search.tsx","docPath":"docs/ui/components/search.md","doc":"# Search 搜索框\n\n搜索框用于输入关键字并触发搜索,支持清空、取消、聚焦和自定义操作区域。\n\n```tsx\nimport { Search } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 受控搜索\n\n通过 `value` 和 `onChange` 管理关键词,事件中的 `value` 为当前输入内容。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Search\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n placeholder=\"请输入关键词\"\n/>\n```\n\n## 组件状态\n\n### 禁用搜索\n\n设置 `disabled` 禁止编辑搜索内容。\n\n```tsx\n<Search value=\"搜索内容\" disabled />\n```\n\n## 内容形态\n\n### 输入提示\n\n通过 `placeholder` 设置搜索框的占位提示。\n\n```tsx\n<Search placeholder=\"搜索商品、品牌\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `string` | — |\n| defaultValue | 非受控模式的初始值 | `string` | `''` |\n| type | 类型 | `InputProps['type']` | `'text'` |\n| placeholder | 占位内容或输入提示 | `string` | `'搜索'` |\n| cancelTxt | 取消文案 | `string` | `'取消'` |\n| variant | 外观变体 | `'plain' \\| 'filled' \\| 'light'` | `'plain'` |\n| hideCancel | 是否隐藏取消按钮 | `boolean` | `false` |\n| disabled | 是否禁用 | `boolean` | `false` |\n| maxlength | 最大输入长度,-1 表示不限制 | `number \\| string` | `-1` |\n| placeholderLeft | 占位区左侧内容 | `boolean` | `false` |\n| focus | 是否获取输入焦点 | `boolean` | — |\n| focusWhenClear | 清空后是否自动聚焦 | `boolean` | `false` |\n| placeholderColor | 占位文字颜色 | `string` | — |\n| prefix | 前置内容 | `ReactNode` | — |\n| inputSuffix | inputSuffix 配置 | `ReactNode` | — |\n| suffix | 后置内容 | `ReactNode` | — |\n| inputClassName | 输入区域类名 | `string` | `''` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: string }) => void |\n| onSearch | 对应操作发生时触发 | (event: { value: string }) => void |\n| onCancel | 取消操作时触发 | (event: { value: string }) => void |\n| onClear | 清空内容时触发 | () => void |\n| onFocus | 获得焦点时触发 | (event: TextFieldEvent) => void |\n| onBlur | 失去焦点时触发 | (event: TextFieldEvent) => void |\n| onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 前置内容 | ReactNode |\n| inputSuffix | 自定义区域内容 | ReactNode |\n| suffix | 后置内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| focus | 获得焦点 | () => void |\n| blur | 失去焦点 | () => void |\n| setSelectionRange | 调用实例方法 | (start: number, end: number) => void |\n\n## 数据类型\n\n```tsx\nexport type TextFieldEvent = {\n value: string;\n selectionStart?: number;\n selectionEnd?: number;\n isComposing?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text-placeholder` | 共享主题 |\n\n## 源代码\n\n[Search 组件源码](./sources/search/Search.tsx.txt) · [示例源码](./sources/search/demo.tsx.txt) · [文档源码](./sources/search/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Icon, Popover, Search, Toast, useToast } from 'daisu-ui';\nimport type { PopoverRef, SearchProps } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nfunction Sample({ defaultValue = '', ...props }: SearchProps) { const [value, setValue] = useState(defaultValue); return <Search {...props} value={value} onChange={({ value }) => { 'background only'; setValue(value); }} />; }\nexport function SearchExample({ theme }: { theme: 'light' | 'dark' }) {\n const iconColor = theme === 'dark' ? '#e5e6eb' : '#4e5369';\n const primaryColor = theme === 'dark' ? '#5b90ff' : '#1c64fd';\n const [basic, setBasic] = useState(''), [searchType, setSearchType] = useState('全部'), [filterOpen, setFilterOpen] = useState(false);\n const popovers = useRef<Record<string, PopoverRef | null>>({}), toast = useToast();\n const closeAll = (except?: string) => { 'background only'; for (const [key, ref] of Object.entries(popovers.current)) if (key !== except) ref?.close(); };\n const popoverProps = (key: string) => ({ ref: (ref: PopoverRef | null) => { 'background only'; popovers.current[key] = ref; }, onOpen: () => { 'background only'; closeAll(key); } });\n const scan = <Icon name=\"scan\" size={20} color={iconColor} />;\n const actions = <view className=\"demo-search-actions\"><Icon name=\"filter\" size={20} color={iconColor} onTap={() => { 'background only'; toast.show('筛选'); }} /><Icon name=\"plus-circle-fill\" size={20} color={primaryColor} onTap={() => { 'background only'; toast.show('新增'); }} /></view>;\n return <view className=\"demo-search-page\" bindtap={() => { 'background only'; closeAll(); }}>\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\" noPadding><Search value={basic} onChange={({ value }) => { 'background only'; setBasic(value); }} onSearch={({ value }) => { 'background only'; toast.show(`搜索${value}`); }} onCancel={() => { 'background only'; toast.show('取消'); }} onClear={() => { 'background only'; toast.show('清空'); }} /></ExampleBlock>\n <ExampleBlock title=\"数字类型\" noPadding><Sample type=\"number\" placeholder=\"请输入手机号\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"自动聚焦\" noPadding><Sample focus /></ExampleBlock>\n <ExampleBlock title=\"清空后自动聚焦\" noPadding><Sample focusWhenClear /></ExampleBlock>\n <ExampleBlock title=\"禁用且隐藏取消按钮\" noPadding><Search disabled hideCancel onTap={() => { 'background only'; toast.show('禁用点击'); }} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"样式变体\" noPadding><Sample variant=\"plain\" /><Sample variant=\"filled\" className=\"demo-search-mt\" /><Sample variant=\"light\" className=\"demo-search-mt\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"搜索占位符居左\" noPadding><Sample placeholderLeft /></ExampleBlock>\n <ExampleBlock title=\"设置最大长度\" noPadding><Sample defaultValue=\"初始文案\" maxlength={4} /></ExampleBlock>\n <ExampleBlock title=\"自定义右侧文案\" noPadding><Sample placeholder=\"请输入订单号/订单名称\" cancelTxt=\"搜索\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"自定义左侧插槽\" noPadding><Sample prefix={<Popover {...popoverProps('prefix')} mode=\"menu\" content={[{ content: '全部' }, { content: '订单号' }, { content: '退款单号' }]} onMenuClick={({ item }) => { 'background only'; setSearchType(item.content); }}><view className=\"demo-search-type\" style={{ width: `${searchType.length * 16 + 46}px` }}><text>{searchType}</text><Icon name=\"caret-down\" size={18} color={iconColor} /><view className=\"demo-search-type-divider\" /></view></Popover>} /></ExampleBlock>\n <ExampleBlock title=\"自定义输入框右侧图标\" noPadding><Sample inputSuffix={scan} /></ExampleBlock>\n <ExampleBlock title=\"自定义右侧插槽\" noPadding><Sample inputSuffix={scan} suffix={<Popover {...popoverProps('filter')} mode=\"menu\" content={[{ content: '气泡文本' }, { content: '气泡文本' }, { content: '气泡文本' }]} placement=\"bottom\" onOpen={() => { 'background only'; closeAll('filter'); setFilterOpen(true); }} onClose={() => { 'background only'; setFilterOpen(false); }}><view className=\"demo-search-filter\"><text>筛选条件</text><Icon name={filterOpen ? 'caret-up' : 'caret-down'} size={16} color={iconColor} /></view></Popover>} /></ExampleBlock>\n <ExampleBlock title=\"多种插槽组合\" noPadding><Sample variant=\"plain\" inputSuffix={scan} suffix={actions} /><Sample variant=\"filled\" className=\"demo-search-mt\" inputSuffix={scan} suffix={actions} /><view className=\"demo-search-light demo-search-mt\"><Sample variant=\"light\" inputSuffix={scan} suffix={actions} /></view></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"value","type":"string","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"string","optional":true,"description":"非受控模式的初始值","defaultValue":"''"},{"name":"type","type":"InputProps['type']","optional":true,"description":"类型","defaultValue":"'text'","values":["number","text","email","digit","password","tel"]},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示","defaultValue":"'搜索'"},{"name":"cancelTxt","type":"string","optional":true,"description":"取消文案","defaultValue":"'取消'"},{"name":"variant","type":"'plain' | 'filled' | 'light'","optional":true,"description":"外观变体","defaultValue":"'plain'","values":["plain","light","filled"]},{"name":"hideCancel","type":"boolean","optional":true,"description":"是否隐藏取消按钮","defaultValue":"false","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","defaultValue":"false","values":[false,true]},{"name":"maxlength","type":"number | string","optional":true,"description":"最大输入长度,-1 表示不限制","defaultValue":"-1"},{"name":"placeholderLeft","type":"boolean","optional":true,"description":"占位区左侧内容","defaultValue":"false","values":[false,true]},{"name":"focus","type":"boolean","optional":true,"description":"是否获取输入焦点","values":[false,true]},{"name":"focusWhenClear","type":"boolean","optional":true,"description":"清空后是否自动聚焦","defaultValue":"false","values":[false,true]},{"name":"placeholderColor","type":"string","optional":true,"description":"占位文字颜色"},{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"},{"name":"inputSuffix","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后置内容"},{"name":"inputClassName","type":"string","optional":true,"description":"输入区域类名","defaultValue":"''"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: string }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onSearch","type":"(event: { value: string }) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onCancel","type":"(event: { value: string }) => void","optional":true,"description":"取消操作时触发"},{"name":"onClear","type":"() => void","optional":true,"description":"清空内容时触发"},{"name":"onFocus","type":"(event: TextFieldEvent) => void","optional":true,"description":"获得焦点时触发"},{"name":"onBlur","type":"(event: TextFieldEvent) => void","optional":true,"description":"失去焦点时触发"},{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"},{"name":"inputSuffix","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"suffix","type":"ReactNode","optional":true,"description":"后置内容"}],"methods":[{"name":"focus","description":"获得焦点","type":"() => void"},{"name":"blur","description":"失去焦点","type":"() => void"},{"name":"setSelectionRange","description":"调用实例方法","type":"(start: number, end: number) => void"}],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","受控搜索"],"title":"受控搜索","section":"组件类型","description":"通过 `value` 和 `onChange` 管理关键词,事件中的 `value` 为当前输入内容。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Search\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n placeholder=\"请输入关键词\"\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Search\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n placeholder=\"请输入关键词\"\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用搜索"],"title":"禁用搜索","section":"组件状态","description":"设置 `disabled` 禁止编辑搜索内容。","language":"tsx","code":"<Search value=\"搜索内容\" disabled />\n","blocks":[{"language":"tsx","code":"<Search value=\"搜索内容\" disabled />\n"}]},{"name":"demo-3","aliases":["demo-3","输入提示"],"title":"输入提示","section":"内容形态","description":"通过 `placeholder` 设置搜索框的占位提示。","language":"tsx","code":"<Search placeholder=\"搜索商品、品牌\" />\n","blocks":[{"language":"tsx","code":"<Search placeholder=\"搜索商品、品牌\" />\n"}]}],"allowUnknownProps":false},{"name":"SectionTitle","id":"card","label":"Card 卡片","category":"基础","categoryId":"basic","kind":"component","description":"卡片用于聚合标题、正文与底部操作。标准卡片适合独立内容块,矩形卡片适合连续列表。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Card.tsx","docPath":"docs/ui/components/card.md","doc":"# Card 卡片\n\n卡片用于聚合标题、正文与底部操作。标准卡片适合独立内容块,矩形卡片适合连续列表。\n\n```tsx\nimport { Card } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 标准卡片\n\n设置 `variant=\"standard\"` 使用标准卡片,通过 `title` 设置标题。\n\n```tsx\n<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n```\n\n### 矩形卡片\n\n设置 `type=\"rectangle\"` 使用矩形卡片,适合连续排列的内容区域。\n\n```tsx\n<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n```\n\n## 内容形态\n\n### 自定义标题与操作\n\n通过 `title` 自定义标题节点,通过 `footer` 设置底部操作,子节点作为正文内容。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode | `ReactNode` | — |\n| description | 兼容原业务说明,standard也可使用 | `string` | — |\n| children | 卡片内容,原始字符串/数字自动包text;standard始终保留内容容器 | `ReactNode` | — |\n| footer | 底部ReactNode;未提供/false不渲染,0有效 | `ReactNode` | — |\n| variant | business保留既有样式;standard使用标准样式 | `'business' \\| 'standard'` | — |\n| type | rectangle:矩形、无横边距和阴影;未传variant时自动选standard | `'rectangle'` | — |\n| customTitleClass | 三个区域的类名 | `string` | `''` |\n| customContentClass | 三个区域的类名 | `string` | `''` |\n| customFooterClass | 三个区域的类名 | `string` | `''` |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode | ReactNode |\n| children | 卡片内容,原始字符串/数字自动包text;standard始终保留内容容器 | ReactNode |\n| footer | 底部ReactNode;未提供/false不渲染,0有效 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Card 组件源码](./sources/card/Card.tsx.txt) · [示例源码](./sources/card/demo.tsx.txt) · [文档源码](./sources/card/docs.md.txt)\n","demoSource":"import { Button, Card, Dialog, Icon, Toast, useDialog, useToast } from 'daisu-ui';\nimport type { ReactNode } from '@lynx-js/react';\nimport cat from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst passage='至若春和景明,波澜不惊,上下天光,一碧万顷,沙鸥翔集,锦鳞游泳,岸芷汀兰,郁郁青青。而或长烟一空,皓月千里,浮光跃金,静影沉璧,渔歌互答,此乐何极!登斯楼也,则有心旷神怡,宠辱偕忘,把酒临风,其喜洋洋者矣。';\nfunction CardList({items}:{items:[string,string][]}){return <view className=\"demo-card-list\">{items.map(([title,description])=><view className=\"demo-card-list-item\" key={title}><image className=\"demo-card-list-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-list-copy\"><text className=\"demo-card-list-title\">{title}</text><text className=\"demo-card-description\">{description}</text></view></view>)}</view>;}\nfunction CardTitle({title,tip,icon}:{title:string;tip:string;icon:string}){return <view className=\"demo-card-custom-title\"><text>{title}</text><view className=\"demo-card-title-tip\"><Icon name={icon} size={14} color=\"#868a9c\"/><text>{tip}</text></view></view>;}\nexport function CardExample(){\n const toast=useToast(),dialog=useDialog();\n const actions=(labels:string[]):ReactNode=><view className=\"demo-card-actions\">{labels.map(label=><Button key={label} size=\"small\" variant=\"plain\" label={label} onTap={()=>{ 'background only'; if(label==='阅读全文')void dialog.alert({title:'岳阳楼记',msg:passage});else toast.success(`${label}成功`); }}/>)}</view>;\n return <view className=\"demo-card-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock noPadding title=\"基本使用\">\n <Card variant=\"standard\" title=\"岳阳楼记\" footer={actions(['阅读全文'])}><text className=\"demo-card-passage\">{passage}</text></Card>\n <Card variant=\"standard\" title=\"个人名片\" footer={actions(['关注'])}><view className=\"demo-card-user\"><image className=\"demo-card-user-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-user-copy\"><text className=\"demo-card-user-title\">小黑猫的故事</text><text className=\"demo-card-description\">一只温柔的黑色小猫,喜欢在午后的阳光下打滚,追逐蝴蝶。</text><text className=\"demo-card-meta\">粉丝 12.5w</text></view></view></Card>\n </ExampleBlock><ExampleBlock noPadding title=\"矩形卡片\"><Card type=\"rectangle\" title=\"生活记录\" footer={actions(['点赞','评论'])}><CardList items={[[\"今天天气真好\",\"2026年2月11日 晴天 22℃\"],[\"慵懒的午睡时光\",\"阳光洒进房间,舒服得不想动\"]]}/></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock noPadding title=\"复杂卡片\"><Card variant=\"standard\" title=\"宠物档案\" footer={actions(['点赞 (1.2w)','收藏','分享'])}><view className=\"demo-card-info\"><view className=\"demo-card-info-image-box\"><image className=\"demo-card-info-image\" src={cat} mode=\"aspectFill\"/><text className=\"demo-card-info-badge\">人气之星</text></view><view className=\"demo-card-info-copy\"><text className=\"demo-card-info-title\">小黑:治愈系黑色小猫咪</text><view className=\"demo-card-info-meta\"><text className=\"demo-card-info-tag\">萌宠日常</text><text className=\"demo-card-info-time\">2小时前发布</text></view><view className=\"demo-card-props\">{[[['品种','中华田园猫'],['性格','活泼好动'],['特技','高能跳跃']],[['年龄','0.5岁'],['性别','女'],['坐标','上海']]].map((column,index)=><view key={index} className=\"demo-card-prop-col\">{column.map(([label,value])=><view key={label} className=\"demo-card-prop\"><text className=\"demo-card-prop-label\">{label}</text><text className=\"demo-card-prop-value\">{value}</text></view>)}</view>)}</view></view></view></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock noPadding title=\"自定义标题\"><Card type=\"rectangle\" title={<CardTitle title=\"兴趣爱好\" tip=\"快乐源泉\" icon=\"heart\"/>} footer={actions(['点赞','分享'])}><CardList items={[[\"窗边的午睡\",\"最喜欢在温暖的阳光下打盹\"],[\"毛线球游戏\",\"追逐毛线球时最专注最可爱\"]]}/></Card></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock noPadding title=\"去除 Footer\"><Card type=\"rectangle\" title=\"精彩瞬间\"><view className=\"demo-card-moment\"><image className=\"demo-card-user-image\" src={cat} mode=\"aspectFill\"/><view className=\"demo-card-moment-copy\"><text className=\"demo-card-moment-title\">午后阳光下的惬意时光</text><text className=\"demo-card-description\">今天的天气真好,阳光洒在身上暖洋洋的。小黑在窗台上睡得正香,偶尔动动耳朵,大概是梦见了好吃的鱼罐头吧。</text><text className=\"demo-card-meta\">阅读 3.5w</text></view></view></Card><Card type=\"rectangle\" title={<CardTitle title=\"更多动态\" tip=\"每日更新\" icon=\"warning\"/>}><CardList items={[[\"翻肚皮打滚特技\",\"超级可爱的示范表演,萌化你的心\"],[\"高空跳跃绝技\",\"展现猫咪的灵活身手,惊叹连连\"]]}/></Card></ExampleBlock></DemoGroup>\n <Dialog {...dialog.props}/><Toast {...toast.props}/>\n </view>;\n}\n","props":[{"name":"eyebrow","type":"string","optional":true,"description":""},{"name":"title","type":"string","optional":false,"description":"ReactNode;字符串/数字用原生text,standard单行省略;复杂标题使用 ReactNode"},{"name":"description","type":"string","optional":true,"description":"兼容原业务说明,standard也可使用"}],"events":[],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","标准卡片"],"title":"标准卡片","section":"组件类型","description":"设置 `variant=\"standard\"` 使用标准卡片,通过 `title` 设置标题。","language":"tsx","code":"<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n","blocks":[{"language":"tsx","code":"<Card variant=\"standard\" title=\"生活记录\">\n <text>今天也是值得记录的一天。</text>\n</Card>\n"}]},{"name":"demo-2","aliases":["demo-2","矩形卡片"],"title":"矩形卡片","section":"组件类型","description":"设置 `type=\"rectangle\"` 使用矩形卡片,适合连续排列的内容区域。","language":"tsx","code":"<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n","blocks":[{"language":"tsx","code":"<Card type=\"rectangle\" title=\"项目动态\">\n <text>项目已更新。</text>\n</Card>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义标题与操作"],"title":"自定义标题与操作","section":"内容形态","description":"通过 `title` 自定义标题节点,通过 `footer` 设置底部操作,子节点作为正文内容。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Card\n variant=\"standard\"\n title={<text>订单详情</text>}\n footer={<Button label=\"查看\" size=\"small\" />}\n>\n <text>订单编号:20260001</text>\n</Card>\n"}]}],"allowUnknownProps":false},{"name":"Segmented","id":"segmented","label":"Segmented 分段器","category":"导航","categoryId":"navigation","kind":"component","description":"分段器用于展示多个选项并允许用户选择其中单个选项。适合在同一区域切换少量互斥选项及其关联内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Segmented.tsx","docPath":"docs/ui/components/segmented.md","doc":"# Segmented 分段器\n\n分段器用于展示多个选项并允许用户选择其中单个选项。适合在同一区域切换少量互斥选项及其关联内容。\n\n```tsx\nimport { Segmented } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础用法\n\n通过 `options` 设置选项列表,通过 `value` 和 `onChange` 管理当前选中项。非受控使用时可通过 `defaultValue` 设置初始选中项。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Segmented\n options={['评论', '点赞', '贡献', '打赏']}\n value={value}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n/>\n```\n\n## 组件状态\n\n### 禁用\n\n设置 `disabled` 禁用整个分段器,也可以为 `options` 中的单个选项设置 `disabled`。\n\n```tsx\n<Segmented\n disabled\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n<Segmented\n options={[\n { value: '评论' },\n { value: '点赞', disabled: true },\n { value: '贡献' },\n ]}\n/>\n```\n\n## 组件变体\n\n### 轮廓主题\n\n通过 `theme=\"outline\"` 切换为轮廓样式,默认使用 `card` 卡片主题。\n\n```tsx\n<Segmented\n theme=\"outline\"\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n```\n\n## 组件样式\n\n### 自定义渲染分段器标签\n\n通过 `renderLabel` 自定义标签,回调提供 `option`、`active` 和 `disabled`。选项的额外数据可放入 `payload`。\n\n```tsx\n<Segmented\n options={[\n { value: '李雷', payload: { role: '设计师' } },\n { value: '韩梅梅', payload: { role: '开发者' } },\n ]}\n renderLabel={({ option, active }) => (\n <view>\n <text>\n {active ? '✓ ' : ''}\n {option.value}\n </text>\n <text>{option.payload?.role}</text>\n </view>\n )}\n/>\n```\n\n## 特殊样式\n\n### 在弹出框中使用\n\n通过 `Popup` 的 `show` 控制弹出框,在其中放入分段器即可使用;选中项仍由 `value` 和 `onChange` 管理。\n\n```tsx\nimport { Button, Popup } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Button\n label=\"打开弹出框\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup\n show={show}\n onChange={(next) => {\n 'background only';\n setShow(next);\n }}\n position=\"bottom\"\n closable\n round\n rootPortal\n style={{ padding: '24px', minHeight: '180px' }}\n>\n <Segmented\n value={value}\n options={['评论', '点赞', '贡献', '打赏']}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n />\n</Popup>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| options | 等宽选项;值须唯一,字符串与数值严格区分 | `readonly SegmentedInput<T>[]` | `[]` |\n| value | 对应 v-model:value,受控值 | `SegmentedValue` | — |\n| defaultValue | 非受控初始值 | `SegmentedValue` | — |\n| disabled | 禁用全部选项,保留选中显示,不触发事件 | `boolean` | `false` |\n| theme | 卡片滑块或轮廓分隔样式 | `'card' \\| 'outline'` | `'card'` |\n| className | 对应 custom-class | `string` | `''` |\n\n泛型约束:`T = unknown`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 用户选择不同的可用项时触发;参数包含 value、disabled、payload | (option: SegmentedOption<T>) => void |\n| onClick | 每次点击可用项触发,包括重复点击当前项;先change后click | (option: SegmentedOption<T>) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderLabel | 对应 label 插槽,可渲染头像等内容 | (state: { option: SegmentedOption<T>; active: boolean; disabled: boolean }) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type SegmentedInput<T = unknown> = SegmentedValue | SegmentedOption<T>;\n\nexport type SegmentedValue = string | number;\n\nexport type SegmentedOption<T = unknown> = {\n value: SegmentedValue;\n disabled?: boolean;\n payload?: T;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Segmented 组件源码](./sources/segmented/Segmented.tsx.txt) · [示例源码](./sources/segmented/demo.tsx.txt) · [文档源码](./sources/segmented/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Icon, RootPortal, Segmented, Transition } from 'daisu-ui';\nimport type { SegmentedOption } from 'daisu-ui';\nimport redpanda from '../../../assets/demo-red-panda.jpg';\nimport capybara from '../../../assets/demo-capybara.jpg';\nimport panda from '../../../assets/demo-panda.jpg';\nimport meng from '../../../assets/demo-landscape.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst options = ['评论', '点赞', '贡献', '打赏'];\nconst people: readonly SegmentedOption<{ avatar: string }>[] = [\n { value: '李雷', disabled: true, payload: { avatar: redpanda } },\n { value: '韩梅梅', payload: { avatar: capybara } },\n { value: '林涛', disabled: true, payload: { avatar: panda } },\n { value: 'Tom', payload: { avatar: meng } },\n];\n\nexport function SegmentedExample() {\n const [outline, setOutline] = useState<string | number>('评论');\n const [person, setPerson] = useState<string | number>('韩梅梅');\n const [popup, setPopup] = useState(false);\n const [popupValue, setPopupValue] = useState<string | number>('点赞');\n const close = () => { 'background only'; setPopup(false); };\n return <view className=\"demo-segmented-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础用法\"><Segmented options={options} defaultValue=\"详情\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用分段器\"><Segmented options={options} value=\"评论\" disabled /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"轮廓主题\"><Segmented options={options} value={outline} onChange={option => { 'background only'; setOutline(option.value); }} theme=\"outline\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义渲染分段器标签\"><Segmented options={people} value={person} onChange={option => { 'background only'; setPerson(option.value); }} renderLabel={({ option, active }) => <view className={`demo-segmented-person ${active ? 'demo-segmented-person-active' : ''}`}><image className=\"demo-segmented-avatar\" src={option.payload!.avatar} mode=\"scaleToFill\" /><text className=\"demo-segmented-name\">{option.value}</text></view>} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"选项切换(暂不支持振动)\"><Segmented options={options} defaultValue=\"打赏\" /></ExampleBlock>\n <ExampleBlock title=\"在弹出框中使用\"><view className=\"demo-segmented-trigger\"><Button label=\"打开弹窗\" onTap={() => { 'background only'; setPopup(true); }} /></view></ExampleBlock>\n </DemoGroup>\n <RootPortal>\n <Transition show={popup} lazyRender name=\"fade\" className=\"ui-demo-page demo-segmented-backdrop\" onTap={close} />\n <Transition show={popup} lazyRender name=\"slide-up\" className=\"ui-demo-page demo-segmented-popup\">\n <view className=\"demo-segmented-popup-title\"><text>在弹出框中使用</text><view className=\"demo-segmented-popup-close\" accessibility-element accessibility-traits=\"button\" accessibility-label=\"关闭弹窗\" bindtap={close}><Icon name=\"close\" size={20} /></view></view>\n <Segmented options={options} value={popupValue} onChange={option => { 'background only'; setPopupValue(option.value); }} />\n </Transition>\n </RootPortal>\n </view>;\n}\n","props":[{"name":"options","type":"readonly SegmentedInput<T>[]","optional":true,"description":"等宽选项;值须唯一,字符串与数值严格区分","defaultValue":"[]"},{"name":"value","type":"SegmentedValue","optional":true,"description":"对应 v-model:value,受控值"},{"name":"defaultValue","type":"SegmentedValue","optional":true,"description":"非受控初始值"},{"name":"disabled","type":"boolean","optional":true,"description":"禁用全部选项,保留选中显示,不触发事件","defaultValue":"false","values":[false,true]},{"name":"theme","type":"'card' | 'outline'","optional":true,"description":"卡片滑块或轮廓分隔样式","defaultValue":"'card'","values":["outline","card"]},{"name":"className","type":"string","optional":true,"description":"对应 custom-class","defaultValue":"''"}],"events":[{"name":"onChange","type":"(option: SegmentedOption<T>) => void","optional":true,"description":"用户选择不同的可用项时触发;参数包含 value、disabled、payload"},{"name":"onClick","type":"(option: SegmentedOption<T>) => void","optional":true,"description":"每次点击可用项触发,包括重复点击当前项;先change后click"}],"slots":[{"name":"renderLabel","type":"(state: { option: SegmentedOption<T>; active: boolean; disabled: boolean }) => ReactNode","optional":true,"description":"对应 label 插槽,可渲染头像等内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","基础用法"],"title":"基础用法","section":"组件类型","description":"通过 `options` 设置选项列表,通过 `value` 和 `onChange` 管理当前选中项。非受控使用时可通过 `defaultValue` 设置初始选中项。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Segmented\n options={['评论', '点赞', '贡献', '打赏']}\n value={value}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Segmented\n options={['评论', '点赞', '贡献', '打赏']}\n value={value}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用"],"title":"禁用","section":"组件状态","description":"设置 `disabled` 禁用整个分段器,也可以为 `options` 中的单个选项设置 `disabled`。","language":"tsx","code":"<Segmented\n disabled\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n<Segmented\n options={[\n { value: '评论' },\n { value: '点赞', disabled: true },\n { value: '贡献' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Segmented\n disabled\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n<Segmented\n options={[\n { value: '评论' },\n { value: '点赞', disabled: true },\n { value: '贡献' },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","轮廓主题"],"title":"轮廓主题","section":"组件变体","description":"通过 `theme=\"outline\"` 切换为轮廓样式,默认使用 `card` 卡片主题。","language":"tsx","code":"<Segmented\n theme=\"outline\"\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n","blocks":[{"language":"tsx","code":"<Segmented\n theme=\"outline\"\n defaultValue=\"点赞\"\n options={['评论', '点赞', '贡献', '打赏']}\n/>\n"}]},{"name":"demo-4","aliases":["demo-4","自定义渲染分段器标签"],"title":"自定义渲染分段器标签","section":"组件样式","description":"通过 `renderLabel` 自定义标签,回调提供 `option`、`active` 和 `disabled`。选项的额外数据可放入 `payload`。","language":"tsx","code":"<Segmented\n options={[\n { value: '李雷', payload: { role: '设计师' } },\n { value: '韩梅梅', payload: { role: '开发者' } },\n ]}\n renderLabel={({ option, active }) => (\n <view>\n <text>\n {active ? '✓ ' : ''}\n {option.value}\n </text>\n <text>{option.payload?.role}</text>\n </view>\n )}\n/>\n","blocks":[{"language":"tsx","code":"<Segmented\n options={[\n { value: '李雷', payload: { role: '设计师' } },\n { value: '韩梅梅', payload: { role: '开发者' } },\n ]}\n renderLabel={({ option, active }) => (\n <view>\n <text>\n {active ? '✓ ' : ''}\n {option.value}\n </text>\n <text>{option.payload?.role}</text>\n </view>\n )}\n/>\n"}]},{"name":"demo-5","aliases":["demo-5","在弹出框中使用"],"title":"在弹出框中使用","section":"特殊样式","description":"通过 `Popup` 的 `show` 控制弹出框,在其中放入分段器即可使用;选中项仍由 `value` 和 `onChange` 管理。","language":"tsx","code":"import { Button, Popup } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Button\n label=\"打开弹出框\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup\n show={show}\n onChange={(next) => {\n 'background only';\n setShow(next);\n }}\n position=\"bottom\"\n closable\n round\n rootPortal\n style={{ padding: '24px', minHeight: '180px' }}\n>\n <Segmented\n value={value}\n options={['评论', '点赞', '贡献', '打赏']}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n />\n</Popup>\n","blocks":[{"language":"tsx","code":"import { Button, Popup } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\nconst [value, setValue] = useState<string | number>('点赞');\n\n<Button\n label=\"打开弹出框\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n/>\n<Popup\n show={show}\n onChange={(next) => {\n 'background only';\n setShow(next);\n }}\n position=\"bottom\"\n closable\n round\n rootPortal\n style={{ padding: '24px', minHeight: '180px' }}\n>\n <Segmented\n value={value}\n options={['评论', '点赞', '贡献', '打赏']}\n onChange={(option) => {\n 'background only';\n setValue(option.value);\n }}\n />\n</Popup>\n"}]}],"allowUnknownProps":false},{"name":"SelectPicker","id":"select-picker","label":"SelectPicker 单复选选择器","category":"录入","categoryId":"form","kind":"component","description":"单复选选择器通过弹层展示列表选项,支持单选、多选和确认操作。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SelectPicker.tsx","docPath":"docs/ui/components/select-picker.md","doc":"# SelectPicker 单复选选择器\n\n单复选选择器通过弹层展示列表选项,支持单选、多选和确认操作。\n\n```tsx\nimport { SelectPicker } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 单选列表\n\n设置 `type=\"radio\"` 使用单选模式,`columns` 配置选项,`visible` 控制面板显示。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<SelectPicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"radio\"\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n```\n\n## 组件变体\n\n### 多选列表\n\n设置 `type=\"checkbox\"` 使用多选模式。\n\n```tsx\n<SelectPicker\n visible={false}\n type=\"checkbox\"\n columns={[\n { value: 'a', label: '选项一' },\n { value: 'b', label: '选项二' },\n ]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `SelectPickerValue` | — |\n| visible | 是否显示选择面板 | `boolean` | — |\n| columns | 列或选项配置 | `readonly (SelectPickerOption \\| Readonly<Record<string, unknown>>)[]` | 必填 |\n| type | 类型 | `'checkbox' \\| 'radio'` | `'checkbox'` |\n| title | 标题内容 | `string` | `'选择器'` |\n| min | 最小值 | `number` | `0` |\n| max | 最大值或数量上限 | `number` | `0` |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | `false` |\n| filterable | 是否允许筛选选项 | `boolean` | `false` |\n| filterPlaceholder | 筛选输入框占位文案 | `string` | `'搜索'` |\n| confirmButtonText | 确认按钮文案 | `string` | `'确认'` |\n| showConfirm | 是否显示确认按钮 | `boolean` | `true` |\n| valueKey | 选项值字段名 | `string` | `'value'` |\n| labelKey | 显示文案字段名 | `string` | `'label'` |\n| checkedColor | 选中颜色 | `string` | — |\n| selectSize | 选中项尺寸 | `'large'` | — |\n| loadingColor | 加载指示器颜色 | `string` | `'#4D80F0'` |\n| beforeConfirm | 确认前校验 | `(value: ChoiceValue \\| ChoiceValue[]) => boolean \\| Promise<boolean>` | — |\n| closeOnClickModal | 点击遮罩是否关闭 | `boolean` | `true` |\n| scrollIntoView | 滚动定位配置 | `boolean` | `true` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| zIndex | 浮层层级 | `number` | `100` |\n| safeAreaInsetBottom | 是否预留底部安全区 | `boolean` | `true` |\n| safeAreaBottom | 底部安全区高度 | `number` | `0` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| contentClassName | 内容区域类名 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: ChoiceValue \\| ChoiceValue[] }) => void |\n| onVisibleChange | 面板显示状态变化时触发 | (visible: boolean) => void |\n| onConfirm | 确认选择时触发 | (event: { value: ChoiceValue \\| ChoiceValue[]; selectedItems: SelectPickerOption[] }) => void |\n| onCancel | 取消操作时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n| onOpen | 打开时触发 | () => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type SelectPickerValue = ChoiceValue | readonly ChoiceValue[];\n\nexport type ChoiceValue = string | number | boolean;\n\nexport type SelectPickerOption = {\n value: ChoiceValue;\n label: string;\n disabled?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[SelectPicker 组件源码](./sources/select-picker/SelectPicker.tsx.txt) · [示例源码](./sources/select-picker/demo.tsx.txt) · [文档源码](./sources/select-picker/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, SelectPicker, Toast, useToast } from 'daisu-ui';\nimport type { SelectPickerValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport const selectPickerOptions = ['男装', '奢侈品', '女装', '鞋靴', '内衣配饰', '箱包', '美妆护肤', '个性清洁', '钟表珠宝', '手机', '数码', '电脑办公'].map((label, index) => ({ value: String(101 + index), label }));\nconst disabledOptions = [selectPickerOptions[0]!, selectPickerOptions[1]!, selectPickerOptions[2]!].map((item, index) => ({ ...item, disabled: index === 0 }));\nconst initial: Record<string, SelectPickerValue> = { basic: ['101'], radio: '101', disabled: [], loading: [], title: [], search: ['102'], radioSearch: '102', change: [], validate: [], auto: '101' };\nexport function SelectPickerExample() {\n const [opened, setOpened] = useState(''), [values, setValues] = useState(initial), toast = useToast();\n const example = (key: string, title: string) => {\n const value = values[key], list = Array.isArray(value) ? value : [value], display = list.map(value => selectPickerOptions.find(item => item.value === value)?.label ?? '').join(', ');\n return <ExampleBlock key={key} title={title} noPadding><CellGroup border><Cell title={title} value={display} ellipsis arrow onTap={() => setOpened(key)} /></CellGroup>\n <SelectPicker visible={opened === key} onVisibleChange={show => { 'background only'; if (!show) setOpened(''); }} value={value} columns={key === 'disabled' ? disabledOptions : selectPickerOptions}\n type={['radio', 'radioSearch', 'auto'].includes(key) ? 'radio' : 'checkbox'} title={key === 'title' ? '多选' : '请选择'} loading={key === 'loading'} filterable={key === 'search' || key === 'radioSearch'} showConfirm={key !== 'auto'}\n onChange={key === 'change' ? ({ value }) => { 'background only'; toast.show({ msg: `选择了${value}`, zIndex: 110 }); } : undefined}\n beforeConfirm={key === 'validate' ? value => { 'background only'; if (Array.isArray(value) && value.length) { toast.error({ msg: '暂时无法选择商品', zIndex: 110 }); return false; } return true; } : undefined}\n onConfirm={({ value }) => { 'background only'; setValues(previous => ({ ...previous, [key]: value })); }} />\n </ExampleBlock>;\n };\n return <view className=\"demo-select-picker-page\">\n <DemoGroup title=\"组件类型\">{example('basic', '选择地址')}{example('radio', '类型切换')}</DemoGroup>\n <DemoGroup title=\"组件状态\">{example('disabled', '禁用选项')}{example('loading', 'loading')}</DemoGroup>\n <DemoGroup title=\"组件样式\">{example('title', '标题')}{example('search', '可搜索')}{example('radioSearch', '单选可搜索')}</DemoGroup>\n <DemoGroup title=\"特殊样式\">{example('change', '选择器change')}{example('validate', 'before-confirm')}{example('auto', '自动完成')}</DemoGroup>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"value","type":"SelectPickerValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"visible","type":"boolean","optional":true,"description":"是否显示选择面板","values":[false,true]},{"name":"columns","type":"readonly (SelectPickerOption | Readonly<Record<string, unknown>>)[]","optional":false,"description":"列或选项配置","defaultValue":"必填"},{"name":"type","type":"'checkbox' | 'radio'","optional":true,"description":"类型","defaultValue":"'checkbox'","values":["checkbox","radio"]},{"name":"title","type":"string","optional":true,"description":"标题内容","defaultValue":"'选择器'"},{"name":"min","type":"number","optional":true,"description":"最小值","defaultValue":"0"},{"name":"max","type":"number","optional":true,"description":"最大值或数量上限","defaultValue":"0"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","defaultValue":"false","values":[false,true]},{"name":"filterable","type":"boolean","optional":true,"description":"是否允许筛选选项","defaultValue":"false","values":[false,true]},{"name":"filterPlaceholder","type":"string","optional":true,"description":"筛选输入框占位文案","defaultValue":"'搜索'"},{"name":"confirmButtonText","type":"string","optional":true,"description":"确认按钮文案","defaultValue":"'确认'"},{"name":"showConfirm","type":"boolean","optional":true,"description":"是否显示确认按钮","defaultValue":"true","values":[false,true]},{"name":"valueKey","type":"string","optional":true,"description":"选项值字段名","defaultValue":"'value'"},{"name":"labelKey","type":"string","optional":true,"description":"显示文案字段名","defaultValue":"'label'"},{"name":"checkedColor","type":"string","optional":true,"description":"选中颜色"},{"name":"selectSize","type":"'large'","optional":true,"description":"选中项尺寸","values":["large"]},{"name":"loadingColor","type":"string","optional":true,"description":"加载指示器颜色","defaultValue":"'#4D80F0'"},{"name":"beforeConfirm","type":"(value: ChoiceValue | ChoiceValue[]) => boolean | Promise<boolean>","optional":true,"description":"确认前校验"},{"name":"closeOnClickModal","type":"boolean","optional":true,"description":"点击遮罩是否关闭","defaultValue":"true","values":[false,true]},{"name":"scrollIntoView","type":"boolean","optional":true,"description":"滚动定位配置","defaultValue":"true","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"100"},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"是否预留底部安全区","defaultValue":"true","values":[false,true]},{"name":"safeAreaBottom","type":"number","optional":true,"description":"底部安全区高度","defaultValue":"0"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"contentClassName","type":"string","optional":true,"description":"内容区域类名","defaultValue":"''"}],"events":[{"name":"onChange","type":"(event: { value: ChoiceValue | ChoiceValue[] }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onVisibleChange","type":"(visible: boolean) => void","optional":true,"description":"面板显示状态变化时触发"},{"name":"onConfirm","type":"(event: { value: ChoiceValue | ChoiceValue[]; selectedItems: SelectPickerOption[] }) => void","optional":true,"description":"确认选择时触发"},{"name":"onCancel","type":"() => void","optional":true,"description":"取消操作时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","单选列表"],"title":"单选列表","section":"组件类型","description":"设置 `type=\"radio\"` 使用单选模式,`columns` 配置选项,`visible` 控制面板显示。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<SelectPicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"radio\"\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [visible, setVisible] = useState(false);\n\n<Button\n label=\"选择\"\n onTap={() => {\n 'background only';\n setVisible(true);\n }}\n/>\n<SelectPicker\n visible={visible}\n onVisibleChange={setVisible}\n type=\"radio\"\n columns={[\n { value: 1, label: '选项一' },\n { value: 2, label: '选项二' },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","多选列表"],"title":"多选列表","section":"组件变体","description":"设置 `type=\"checkbox\"` 使用多选模式。","language":"tsx","code":"<SelectPicker\n visible={false}\n type=\"checkbox\"\n columns={[\n { value: 'a', label: '选项一' },\n { value: 'b', label: '选项二' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<SelectPicker\n visible={false}\n type=\"checkbox\"\n columns={[\n { value: 'a', label: '选项一' },\n { value: 'b', label: '选项二' },\n ]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"shouldFinishBack","id":"router","label":"Router 路由","category":"导航","categoryId":"navigation","kind":"utility","description":"路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/RouterView.tsx","docPath":"docs/ui/components/router.md","doc":"# Router 路由\n\n路由用于组织页面导航、返回栈和页面转场,支持页面保活、导航守卫与侧滑返回。\n\n```tsx\nimport { RouterView } from 'daisu-ui/router';\n```\n\n## 基础用法\n\n### 创建页面路由\n\n通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| router | 页面路由实例 | `Router<R, TTree>` | 必填 |\n| controllerRef | 页面栈控制器引用 | `MutableRefObject<RouterViewController \\| null>` | — |\n| canSwipeBack | 判断当前页面是否允许侧滑返回 | `boolean` | — |\n| sceneClassName | 页面场景类名生成函数 | `string` | — |\n| viewportWidth | 页面可用宽度 | `number` | `375` |\n| platform | 当前运行平台 | `string` | — |\n| systemGestureInsetLeft | 系统左侧手势区域宽度 | `number` | `0` |\n\n泛型约束:`R`、`TTree extends AnyRoute = AnyRoute`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onExit | 对应操作发生时触发 | void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderRoute | 自定义区域内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type RouterViewController = { back(): void; isBusy(): boolean };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[RouterView 组件源码](./sources/router/RouterView.tsx.txt) · [示例源码](./sources/router/demo.tsx.txt) · [文档源码](./sources/router/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Button } from 'daisu-ui';\nimport { useRoute, useRouterSnapshot } from 'daisu-ui/router';\nimport type { AppRoute } from '../../../app/router.js';\nimport { useAppRouter } from '../../../app/router.js';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function RouterExample() {\n const router = useAppRouter();\n const route = useRoute<AppRoute>();\n const snapshot = useRouterSnapshot(router);\n const [blockBack, setBlockBack] = useState(false);\n const [notice, setNotice] = useState('');\n useEffect(() => router.beforeEach(navigation => {\n 'background only';\n if (navigation.from === route && blockBack && (navigation.action === 'back' || navigation.source === 'history')) {\n setNotice('已阻止返回,请先关闭导航守卫');\n return false;\n }\n }), [router, route, blockBack]);\n return <view>\n <DemoGroup title=\"当前路由\">\n <ExampleBlock title=\"页面与页面栈\">\n <text className=\"catalog-card-copy\">{router.href(route)}</text>\n <text className=\"catalog-card-copy\">{`页面栈:${snapshot.entries.length} 页`}</text>\n {snapshot.entries.slice(-5).map((entry, index) => <text key={entry.key} className=\"catalog-card-copy\">\n {`${Math.max(0, snapshot.entries.length - 5) + index + 1}. ${router.href(entry.route)}${entry.route === route ? '(本页面)' : ''}`}\n </text>)}\n <text className=\"catalog-card-copy\">TanStack Router 管理路由匹配与导航;H5 地址同步,刷新恢复当前页面。</text>\n </ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"导航方法\">\n <ExampleBlock title=\"push:打开组件页\">\n <Button label=\"打开 Button 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'button' } }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"push:保留当前页状态\">\n <Button label=\"再打开一个 Router 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'router' } }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"replace:替换当前页\" description=\"只替换栈顶,下层已有的 Router 页面仍然可以返回。\">\n <Button label=\"替换为 Cell 示例\" onTap={() => { 'background only'; void router.navigate({ to: '/ui-demo/$page', params: { page: 'cell' }, replace: true }); }} />\n </ExampleBlock>\n <ExampleBlock title=\"back:返回上一页\">\n <Button label=\"返回上一页\" onTap={() => { 'background only'; void router.back(); }} />\n </ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"导航守卫\">\n <ExampleBlock title=\"同时拦截按钮返回与浏览器后退\">\n <Button label={blockBack ? '关闭返回拦截' : '开启返回拦截'} onTap={() => { 'background only'; setBlockBack(value => !value); setNotice(''); }} />\n {notice ? <text className=\"catalog-card-copy\">{notice}</text> : null}\n </ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of an object."},{"name":"toFixed","type":"string","optional":false,"description":"Returns a string representing a number in fixed-point notation."},{"name":"toExponential","type":"string","optional":false,"description":"Returns a string containing a number represented in exponential notation."},{"name":"toPrecision","type":"string","optional":false,"description":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."},{"name":"valueOf","type":"number","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"toLocaleString","type":"string","optional":false,"description":"Converts a number to a string by using the current or specified locale."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","创建页面路由"],"title":"创建页面路由","section":"基础用法","description":"通过 `createRouter` 创建路由实例,使用 `RouterView.router` 绑定路由,`renderRoute` 定义页面内容。","language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n","blocks":[{"language":"tsx","code":"import { createRootRoute, createRoute } from '@tanstack/react-router';\n\nimport { createRouter } from 'daisu-ui/router';\n\nconst rootRoute = createRootRoute();\n\nconst page = createRoute({\n getParentRoute: () => rootRoute,\n path: '/example',\n});\n\nconst router = createRouter({\n routeTree: rootRoute.addChildren([page]),\n initial: '/example',\n toPath: (path) => path,\n fromMatch: (match) => ({ path: match.pathname }),\n stringify: (route) => route.path,\n});\n\n<RouterView\n router={router}\n renderRoute={(route) => <text>{route.path}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Sidebar","id":"sidebar","label":"Sidebar 侧边栏","category":"导航","categoryId":"navigation","kind":"component","description":"侧边栏用于纵向分类导航,可与内容区组合实现页面切换或锚点联动。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Sidebar.tsx","docPath":"docs/ui/components/sidebar.md","doc":"# Sidebar 侧边栏\n\n侧边栏用于纵向分类导航,可与内容区组合实现页面切换或锚点联动。\n\n```tsx\nimport { Sidebar } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础分类\n\n通过 `items` 配置分类,`value` 指定当前分类,`onChange` 返回选中的值与文案。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('hot');\n\n<Sidebar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { value: 'hot', label: '热门推荐' },\n { value: 'new', label: '新品上架' },\n ]}\n/>\n```\n\n## 交互用法\n\n### 切换前确认\n\n通过 `beforeChange` 在切换前执行校验,返回 `true` 允许切换,返回 `false` 阻止切换。\n\n```tsx\n<Sidebar\n items={[\n { value: 0, label: '分类一' },\n { value: 1, label: '分类二' },\n ]}\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 对应 SidebarItem 子项,value 必须唯一 | `readonly SidebarItem[]` | 必填 |\n| value | 对应 model-value,严格区分数字与字符串 | `SidebarValue` | — |\n| defaultValue | 非受控初始值,未匹配项时无选中态 | `SidebarValue` | `0` |\n| beforeChange | 当前官网签名;不是旧版 {value, resolve} 回调 | `SidebarBeforeChange` | — |\n| className | 对应 custom-class / custom-style | `string` | `''` |\n| style | 对应 custom-class / custom-style | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 切换到另一可用项且钩子允许后触发 | (event: { value: SidebarValue; label: string }) => void |\n\n## 数据类型\n\n```tsx\nexport type SidebarItem = {\n value: SidebarValue;\n label: string;\n disabled?: boolean;\n icon?: string;\n renderIcon?: (state: { active: boolean; disabled: boolean }) => ReactNode;\n badge?: string | number;\n isDot?: boolean;\n max?: number;\n badgeProps?: SidebarBadgeProps;\n className?: string;\n style?: CSSProperties;\n};\n\nexport type SidebarValue = string | number;\n\nexport type SidebarBeforeChange = (\n value: SidebarValue,\n) => boolean | Promise<boolean>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line-strong` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Sidebar 组件源码](./sources/sidebar/Sidebar.tsx.txt) · [示例源码](./sources/sidebar/demo.tsx.txt) · [文档源码](./sources/sidebar/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { List } from '@lynx-js/lynx-ui';\nimport type { ListRef } from '@lynx-js/lynx-ui';\nimport { Button, Cell, Icon, Loading, RootPortal, Sidebar } from 'daisu-ui';\nimport type { SidebarItem } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport { sidebarCategories, sidebarHeaderIndexes, sidebarRowCounts, sidebarSectionAtOffset } from './sidebarModel.js';\n\nimport type { sidebarExamplePages } from '../catalog.js';\nexport type SidebarExamplePage = typeof sidebarExamplePages[number]['id'];\nconst basicItems: readonly SidebarItem[] = [0, 1, 2].map(value => ({ value, label: '标签名称' }));\nconst badgeItems: readonly SidebarItem[] = basicItems.map((item, index) => ({ ...item, ...(index === 0 ? { isDot: true } : index === 1 ? { badge: 5 } : { badgeProps: { value: 55, type: 'warning' as const } }) }));\nconst disabledItems: readonly SidebarItem[] = basicItems.map((item, index) => ({ ...item, disabled: index === 1 }));\n\nexport function SidebarExample({ onOpen }: { onOpen: (page: SidebarExamplePage) => void }) {\n const [loading, setLoading] = useState(false);\n const timers = useRef(new Map<ReturnType<typeof setTimeout>, (allowed: boolean) => void>());\n useEffect(() => () => { for (const [timer, resolve] of timers.current) { clearTimeout(timer); resolve(false); } timers.current.clear(); }, []);\n const beforeChange = () => {\n 'background only';\n setLoading(true);\n return new Promise<boolean>(resolve => {\n const timer = setTimeout(() => { 'background only'; timers.current.delete(timer); setLoading(timers.current.size > 0); resolve(true); }, 2000);\n timers.current.set(timer, resolve);\n });\n };\n return <view className=\"demo-sidebar-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础用法\"><view className=\"demo-sidebar-row\"><Sidebar items={basicItems} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"徽标与禁用\"><view className=\"demo-sidebar-row\"><Sidebar items={badgeItems} /><Sidebar items={disabledItems} beforeChange={beforeChange} /></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"锚点用法示例\"><view className=\"demo-sidebar-button\"><Button label=\"锚点用法\" size=\"large\" block onTap={() => { 'background only'; onOpen('sidebar-anchor'); }} /></view></ExampleBlock>\n <ExampleBlock title=\"切换页面用法示例\"><view className=\"demo-sidebar-button\"><Button label=\"切换页面\" size=\"large\" block onTap={() => { 'background only'; onOpen('sidebar-page'); }} /></view></ExampleBlock>\n <ExampleBlock title=\"自定义图标示例\"><view className=\"demo-sidebar-button\"><Button label=\"自定义图标\" size=\"large\" block onTap={() => { 'background only'; onOpen('sidebar-icons'); }} /></view></ExampleBlock>\n </DemoGroup>\n {loading ? <RootPortal><view className=\"demo-sidebar-loading\"><Loading /><text>切换中</text></view></RootPortal> : null}\n </view>;\n}\n\nconst icons = ['thumb-up', 'qrcode', 'location', 'desktop', 'code', 'cloud', 'mobile'];\nconst rows = sidebarRowCounts.flatMap((count, section) => [{ section, row: -1 }, ...Array.from({ length: count }, (_, row) => ({ section, row }))]);\n\nfunction SidebarRows({ section, theme }: { section?: number; theme: 'light' | 'dark' }) {\n const visibleRows = section === undefined ? rows : rows.filter(row => row.section === section);\n return <>{visibleRows.map(({ section: current, row }) => <list-item key={`${current}:${row}`} item-key={`${current}:${row}`} estimated-main-axis-size-px={row === -1 ? 44 : 68} style={{ height: `${row === -1 ? 44 : 68}px` }}>\n {row === -1 ? <view className=\"demo-sidebar-section-title\"><text>{`标题${sidebarCategories[current]}`}</text><view /></view> : <Cell title=\"标题文字\" description=\"这是描述这是描述\" border={row > 0} className=\"demo-sidebar-cell\"><Icon name=\"code\" size={24} color={theme === 'dark' ? '#e5e6eb' : '#4e5369'} /></Cell>}\n </list-item>)}</>;\n}\n\nfunction SidebarPageList({ section, mode, theme }: { section: number; mode: string; theme: 'light' | 'dark' }) {\n return <List listId={`sidebar-${mode}-${section}`} listType=\"single\" spanCount={1} scrollOrientation=\"vertical\" className=\"demo-sidebar-list\"><SidebarRows section={section} theme={theme} /></List>;\n}\n\nexport function SidebarLinkedExample({ page, theme }: { page: SidebarExamplePage; theme: 'light' | 'dark' }) {\n const [active, setActive] = useState(1);\n const [visited, setVisited] = useState<readonly number[]>([1]);\n const list = useRef<ListRef>(null);\n const initialized = useRef(false);\n const pages = page === 'sidebar-page';\n const items: readonly SidebarItem[] = sidebarCategories.map((name, index) => ({\n value: index, label: `分类${name}`, disabled: pages && index === 6,\n ...(page === 'sidebar-anchor' ? {} : { renderIcon: ({ active: selected, disabled }) => <Icon name={pages ? 'thumb-up' : icons[index]!} size={18} color={disabled ? theme === 'dark' ? '#4e5369' : '#c9cbd4' : selected ? theme === 'dark' ? '#5b90ff' : '#1c64fd' : undefined} /> }),\n }));\n return <view className={`demo-sidebar-linked ${pages ? 'demo-sidebar-pages' : 'demo-sidebar-anchors'}`}>\n <Sidebar items={items} value={active} onChange={({ value }) => {\n 'background only';\n const section = Number(value);\n setActive(section);\n if (pages) setVisited(current => [...new Set([...current, ...sidebarCategories.map((_, index) => index).filter(index => index >= Math.min(active, section) && index <= Math.max(active, section))])]);\n else list.current?.scrollTo(false, 'top', sidebarHeaderIndexes[section], 0);\n }} />\n <view className=\"demo-sidebar-content\">\n {pages ? <view className=\"demo-sidebar-page-stack\" style={{ transform: `translateY(-${active * 100}%)` }}>{sidebarCategories.map((_, section) => <view key={section} className=\"demo-sidebar-panel\">{visited.includes(section) ? <SidebarPageList key={active === section ? 'active' : 'inactive'} section={section} mode={page} theme={theme} /> : null}</view>)}</view> : <List ref={list} listId={`sidebar-${page}`} listType=\"single\" spanCount={1} scrollOrientation=\"vertical\" className=\"demo-sidebar-list\" initialScrollIndex={sidebarHeaderIndexes[1]} scrollEventThrottle={16} onLayoutComplete={() => {\n 'background only';\n if (initialized.current) return;\n initialized.current = true;\n list.current?.scrollTo(false, 'top', sidebarHeaderIndexes[1], 0);\n }} onScroll={event => {\n 'background only';\n setActive(sidebarSectionAtOffset(event.detail.scrollTop));\n }}><SidebarRows theme={theme} /></List>}\n </view>\n </view>;\n}\n","props":[{"name":"items","type":"readonly SidebarItem[]","optional":false,"description":"对应 SidebarItem 子项,value 必须唯一","defaultValue":"必填"},{"name":"value","type":"SidebarValue","optional":true,"description":"对应 model-value,严格区分数字与字符串"},{"name":"defaultValue","type":"SidebarValue","optional":true,"description":"非受控初始值,未匹配项时无选中态","defaultValue":"0"},{"name":"beforeChange","type":"SidebarBeforeChange","optional":true,"description":"当前官网签名;不是旧版 {value, resolve} 回调"},{"name":"className","type":"string","optional":true,"description":"对应 custom-class / custom-style","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"对应 custom-class / custom-style"}],"events":[{"name":"onChange","type":"(event: { value: SidebarValue; label: string }) => void","optional":true,"description":"切换到另一可用项且钩子允许后触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line-strong","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","基础分类"],"title":"基础分类","section":"组件类型","description":"通过 `items` 配置分类,`value` 指定当前分类,`onChange` 返回选中的值与文案。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('hot');\n\n<Sidebar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { value: 'hot', label: '热门推荐' },\n { value: 'new', label: '新品上架' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('hot');\n\n<Sidebar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { value: 'hot', label: '热门推荐' },\n { value: 'new', label: '新品上架' },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","切换前确认"],"title":"切换前确认","section":"交互用法","description":"通过 `beforeChange` 在切换前执行校验,返回 `true` 允许切换,返回 `false` 阻止切换。","language":"tsx","code":"<Sidebar\n items={[\n { value: 0, label: '分类一' },\n { value: 1, label: '分类二' },\n ]}\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Sidebar\n items={[\n { value: 0, label: '分类一' },\n { value: 1, label: '分类二' },\n ]}\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Signature","id":"signature","label":"Signature 签名","category":"录入","categoryId":"form","kind":"component","description":"签名组件记录手写笔迹,支持清空、撤销、确认和自定义画笔样式。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Signature.tsx","docPath":"docs/ui/components/signature.md","doc":"# Signature 签名\n\n签名组件记录手写笔迹,支持清空、撤销、确认和自定义画笔样式。\n\n```tsx\nimport { Signature } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 手写签名\n\n通过 `onConfirm` 接收确认后的签名结果。\n\n```tsx\n<Signature\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n```\n\n## 组件样式\n\n### 画笔颜色\n\n通过 `penColor` 设置画笔颜色。\n\n```tsx\n<Signature penColor=\"#1c64fd\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| width | 宽度为 px数字或有效Lynx长度;高度为有限正 px,宽度随容器变化,export按原生实际尺寸 | `number\\|string` | `'100%'` |\n| height | 宽度为 px数字或有效Lynx长度;高度为有限正 px,宽度随容器变化,export按原生实际尺寸 | `number` | `150` |\n| penColor | 后续笔画颜色、普通线宽;旧笔画保留创建时样式 | `string` | `'#000'` |\n| lineWidth | 后续笔画颜色、普通线宽;旧笔画保留创建时样式 | `number` | `3` |\n| backgroundColor | 画板及导出背景;透明画板在白色纸面上显示以保证默认黑色笔迹可见,纸面可用 `--cso-ui-signature-background` 定制 | `string` | `'transparent'` |\n| exportScale | PNG尺寸倍率,不依赖设备 DPR;每边≤4096px且总像素≤400万,超限返回失败 | `number` | `1` |\n| disabled | 禁止书写并取消进行中的笔画;不会清空已有签名,操作按钮仍可用 | `boolean` | `false` |\n| disableScroll | 画板原生手势消费,避免书写拖动外层滚动;不全局锁定页面 | `boolean` | `true` |\n| enableHistory | 启用撤销恢复及每次操作的笔画数,step裁剪为≥1整数 | `boolean` | `false` |\n| step | 启用撤销恢复及每次操作的笔画数,step裁剪为≥1整数 | `number` | `1` |\n| pressure | 模拟速度笔锋,不是设备真实压感;慢写粗、快写细,以20%变化限制平滑线宽 | `boolean` | `false` |\n| minWidth | 笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值 | `number` | `2` |\n| maxWidth | 笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值 | `number` | `6` |\n| minSpeed | 笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值 | `number` | `1.5` |\n| clearText | 默认按钮文案 | `string` | `'清空'` |\n| confirmText | 默认按钮文案 | `string` | `'确认'` |\n| revokeText | 历史按钮文案 | `string` | `'撤销'` |\n| restoreText | 历史按钮文案 | `string` | `'恢复'` |\n| className | 根节点类名、样式 | `string` | `''` |\n| style | 根节点类名、样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onStart | 输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd | (event:TouchEvent\\|MouseEvent)=>void |\n| onSigning | 输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd | (event:TouchEvent\\|MouseEvent)=>void |\n| onEnd | 输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd | (event:TouchEvent\\|MouseEvent)=>void |\n| onConfirm | `(result: SignatureResult) => void`,成功或失败均回调 | (result:SignatureResult)=>void |\n| onClear | 主动清空时触发 | ()=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderFooter | `(actions: SignatureFooter) => ReactNode` 自定义底部操作;传返回null的函数隐藏 | (actions:SignatureFooter)=>ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| init | 调用实例方法 | (forceUpdate?:boolean) => Promise<void> |\n| clear | 调用实例方法 | ()=>void |\n| confirm | 调用实例方法 | ()=>SignatureResult |\n| revoke | 调用实例方法 | ()=>void |\n| restore | 调用实例方法 | ()=>void |\n\n## 数据类型\n\n```tsx\nexport type SignatureFooter = SignatureRef & {\n currentStep: number;\n historyList: readonly SignatureStroke[];\n canUndo: boolean;\n canRedo: boolean;\n};\n\nexport type SignatureResult = {\n success: boolean;\n dataUrl: string;\n width: number;\n height: number;\n error?: string;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-signature-background` | 当前组件 |\n\n## 源代码\n\n[Signature 组件源码](./sources/signature/Signature.tsx.txt) · [示例源码](./sources/signature/demo.tsx.txt) · [文档源码](./sources/signature/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Button, Icon, Popup, Signature, Toast, useToast } from 'daisu-ui';\nimport type { SignatureRef, SignatureResult } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function SignatureExample({onOpen}:{onOpen:(page:'signature-landscape')=>void}){\n const [disabled,setDisabled]=useState(true),[show,setShow]=useState(false),[image,setImage]=useState(''),ref=useRef<SignatureRef>(null),toast=useToast();\n const confirm=(result:SignatureResult)=>{'background only';if(result.success){setShow(false);setImage(result.dataUrl);}else toast.show(result.error??'导出失败');};\n return <view className=\"demo-signature-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础用法\"><Signature exportScale={2} backgroundColor=\"#ffffff\" onConfirm={confirm}/></ExampleBlock><ExampleBlock title=\"历史记录\"><Signature enableHistory backgroundColor=\"#f5f5f5\" onConfirm={confirm}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"笔锋模式-基础\"><Signature pressure height={300} onConfirm={confirm}/></ExampleBlock><ExampleBlock title=\"笔锋模式-自定义\"><Signature pressure height={300} minWidth={1} maxWidth={6} minSpeed={1.5} backgroundColor=\"#f5f5f5\" onConfirm={confirm}/><text className=\"demo-signature-tip\">快速书写产生细线条,慢速书写产生粗线条</text></ExampleBlock><ExampleBlock title=\"笔锋模式 + 历史记录\"><Signature pressure enableHistory height={300} minWidth={1} maxWidth={6} backgroundColor=\"#f5f5f5\" onConfirm={confirm}/><text className=\"demo-signature-tip\">结合历史记录,支持笔锋效果的撤销与恢复</text></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义按钮\"><Signature disabled={disabled} enableHistory step={3} onConfirm={confirm} renderFooter={actions=>disabled?<Button block label=\"开始签名\" onTap={()=>{ 'background only';setDisabled(false);}}/>:<><Button size=\"small\" variant=\"plain\" label=\"撤回\" onTap={actions.revoke} disabled={!actions.canUndo}/><Button size=\"small\" variant=\"plain\" label=\"恢复\" onTap={actions.restore} disabled={!actions.canRedo}/><Button size=\"small\" variant=\"plain\" label=\"清除\" onTap={actions.clear}/><Button size=\"small\" label=\"确定\" onTap={()=>{ 'background only';actions.confirm();}}/></>}/></ExampleBlock><ExampleBlock title=\"自定义画笔\"><Signature penColor=\"#0083ff\" lineWidth={4} onConfirm={confirm}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"弹窗中使用\"><view className=\"demo-signature-button-row\"><Button label=\"打开签名板\" onTap={()=>{ 'background only';setShow(true);}}/></view></ExampleBlock><ExampleBlock title=\"横屏签名\"><view className=\"demo-signature-button-row\"><Button label=\"使用横屏签名\" onTap={()=>{ 'background only';onOpen('signature-landscape');}}/></view></ExampleBlock></DemoGroup>\n <Popup show={show} onChange={setShow} rootPortal position=\"bottom\" closable className=\"demo-signature-popup\" onAfterEnter={()=>{ 'background only';void ref.current?.init();}}><Signature ref={ref} height={300} enableHistory pressure backgroundColor=\"#f5f5f5\" onConfirm={confirm}/></Popup>\n <SignaturePreview src={image} onClose={()=>{ 'background only';setImage('');}}/><Toast {...toast.props}/>\n </view>;\n}\nfunction SignaturePreview({src,onClose}:{src:string;onClose:()=>void}){return <Popup show={!!src} onChange={value=>{ 'background only';if(!value)onClose();}} rootPortal position=\"center\" className=\"demo-signature-preview\"><image src={src} mode=\"aspectFit\" className=\"demo-signature-preview-image\"/><view className=\"demo-signature-preview-close\" bindtap={onClose}><Icon name=\"close\" size={24} color=\"#fff\"/></view></Popup>;}\nexport function SignatureLandscapeExample(){\n const [height,setHeight]=useState(600),[image,setImage]=useState(''),toast=useToast();\n return <view className=\"demo-signature-landscape\" bindlayoutchange={event=>setHeight(Math.max(1,event.detail.height-48))}><Signature width=\"100%\" height={height} enableHistory pressure backgroundColor=\"#f5f5f5\" onConfirm={result=>{ 'background only';if(result.success)setImage(result.dataUrl);else toast.show(result.error??'导出失败');}} renderFooter={actions=><view className=\"demo-signature-landscape-actions\"><Button size=\"small\" label=\"撤回\" variant=\"plain\" onTap={actions.revoke} disabled={!actions.canUndo}/><Button size=\"small\" label=\"恢复\" variant=\"plain\" onTap={actions.restore} disabled={!actions.canRedo}/><Button size=\"small\" label=\"清除\" variant=\"plain\" onTap={actions.clear}/><Button size=\"small\" label=\"完成\" onTap={()=>{ 'background only';actions.confirm();}}/></view>}/><SignaturePreview src={image} onClose={()=>{ 'background only';setImage('');}}/><Toast {...toast.props}/></view>;\n}\n","props":[{"name":"width","type":"number|string","optional":true,"description":"宽度为 px数字或有效Lynx长度;高度为有限正 px,宽度随容器变化,export按原生实际尺寸","defaultValue":"'100%'"},{"name":"height","type":"number","optional":true,"description":"宽度为 px数字或有效Lynx长度;高度为有限正 px,宽度随容器变化,export按原生实际尺寸","defaultValue":"150"},{"name":"penColor","type":"string","optional":true,"description":"后续笔画颜色、普通线宽;旧笔画保留创建时样式","defaultValue":"'#000'"},{"name":"lineWidth","type":"number","optional":true,"description":"后续笔画颜色、普通线宽;旧笔画保留创建时样式","defaultValue":"3"},{"name":"backgroundColor","type":"string","optional":true,"description":"画板及导出背景;透明画板在白色纸面上显示以保证默认黑色笔迹可见,纸面可用 --cso-ui-signature-background 定制","defaultValue":"'transparent'"},{"name":"exportScale","type":"number","optional":true,"description":"PNG尺寸倍率,不依赖设备 DPR;每边≤4096px且总像素≤400万,超限返回失败","defaultValue":"1"},{"name":"disabled","type":"boolean","optional":true,"description":"禁止书写并取消进行中的笔画;不会清空已有签名,操作按钮仍可用","defaultValue":"false","values":[false,true]},{"name":"disableScroll","type":"boolean","optional":true,"description":"画板原生手势消费,避免书写拖动外层滚动;不全局锁定页面","defaultValue":"true","values":[false,true]},{"name":"enableHistory","type":"boolean","optional":true,"description":"启用撤销恢复及每次操作的笔画数,step裁剪为≥1整数","defaultValue":"false","values":[false,true]},{"name":"step","type":"number","optional":true,"description":"启用撤销恢复及每次操作的笔画数,step裁剪为≥1整数","defaultValue":"1"},{"name":"pressure","type":"boolean","optional":true,"description":"模拟速度笔锋,不是设备真实压感;慢写粗、快写细,以20%变化限制平滑线宽","defaultValue":"false","values":[false,true]},{"name":"minWidth","type":"number","optional":true,"description":"笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值","defaultValue":"2"},{"name":"maxWidth","type":"number","optional":true,"description":"笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值","defaultValue":"6"},{"name":"minSpeed","type":"number","optional":true,"description":"笔锋宽度范围及速度阈值(px/ms),非法值使用有效默认值","defaultValue":"1.5"},{"name":"clearText","type":"string","optional":true,"description":"默认按钮文案","defaultValue":"'清空'"},{"name":"confirmText","type":"string","optional":true,"description":"默认按钮文案","defaultValue":"'确认'"},{"name":"revokeText","type":"string","optional":true,"description":"历史按钮文案","defaultValue":"'撤销'"},{"name":"restoreText","type":"string","optional":true,"description":"历史按钮文案","defaultValue":"'恢复'"},{"name":"className","type":"string","optional":true,"description":"根节点类名、样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点类名、样式"}],"events":[{"name":"onStart","type":"(event:TouchEvent|MouseEvent)=>void","optional":true,"description":"输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd"},{"name":"onSigning","type":"(event:TouchEvent|MouseEvent)=>void","optional":true,"description":"输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd"},{"name":"onEnd","type":"(event:TouchEvent|MouseEvent)=>void","optional":true,"description":"输入开始、移动、正常结束;参数为原始Lynx TouchEvent或MouseEvent;取消不提交、不发onEnd"},{"name":"onConfirm","type":"(result:SignatureResult)=>void","optional":true,"description":"(result: SignatureResult) => void,成功或失败均回调"},{"name":"onClear","type":"()=>void","optional":true,"description":"主动清空时触发"}],"slots":[{"name":"renderFooter","type":"(actions:SignatureFooter)=>ReactNode","optional":true,"description":"(actions: SignatureFooter) => ReactNode 自定义底部操作;传返回null的函数隐藏"}],"methods":[{"name":"init","description":"调用实例方法","type":"(forceUpdate?:boolean) => Promise<void>"},{"name":"clear","description":"调用实例方法","type":"()=>void"},{"name":"confirm","description":"调用实例方法","type":"()=>SignatureResult"},{"name":"revoke","description":"调用实例方法","type":"()=>void"},{"name":"restore","description":"调用实例方法","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-signature-background","defaultValue":"#fff","description":""}],"demos":[{"name":"basic","aliases":["demo-1","手写签名"],"title":"手写签名","section":"基础用法","description":"通过 `onConfirm` 接收确认后的签名结果。","language":"tsx","code":"<Signature\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Signature\n onConfirm={(result) => {\n 'background only';\n console.log(result);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","画笔颜色"],"title":"画笔颜色","section":"组件样式","description":"通过 `penColor` 设置画笔颜色。","language":"tsx","code":"<Signature penColor=\"#1c64fd\" />\n","blocks":[{"language":"tsx","code":"<Signature penColor=\"#1c64fd\" />\n"}]}],"allowUnknownProps":false},{"name":"Skeleton","id":"skeleton","label":"Skeleton 骨架屏","category":"数据展示","categoryId":"display","kind":"component","description":"骨架屏用于在数据加载期间展示页面结构占位,支持预设内容和自定义行。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Skeleton.tsx","docPath":"docs/ui/components/skeleton.md","doc":"# Skeleton 骨架屏\n\n骨架屏用于在数据加载期间展示页面结构占位,支持预设内容和自定义行。\n\n```tsx\nimport { Skeleton } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础占位\n\n在数据加载期间展示 `Skeleton`,为即将出现的内容提供结构占位。\n\n```tsx\n<Skeleton />\n```\n\n## 组件样式\n\n### 动画与主题\n\n设置 `animation=\"gradient\"` 使用渐变占位动画。\n\n```tsx\n<Skeleton animation=\"gradient\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| theme | avatar/image/text/paragraph;预设头像/图片64px,文字16px,段落四行 | `SkeletonTheme` | `'text'` |\n| rowCol | readonly SkeletonRow[],非空时替代theme;空数组使用预设 | `readonly SkeletonRow[]` | — |\n| loading | true只渲染骨架;false只渲染children,无隐藏内容提前挂载 | `boolean` | `true` |\n| animation | gradient:1.5秒扫光;flashed:2秒明暗变化 | `'' \\| 'gradient' \\| 'flashed'` | `''` |\n| children | 加载结束内容,原始字符自动包原生text | `ReactNode` | — |\n| className | 根节点样式 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 加载结束内容,原始字符自动包原生text | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type SkeletonTheme = 'avatar' | 'image' | 'text' | 'paragraph';\n\nexport type SkeletonRow = number | SkeletonCell | readonly SkeletonCell[];\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-skeleton-bg` | 当前组件 |\n| `--cso-ui-skeleton-highlight` | 当前组件 |\n\n## 源代码\n\n[Skeleton 组件源码](./sources/skeleton/Skeleton.tsx.txt) · [示例源码](./sources/skeleton/demo.tsx.txt) · [文档源码](./sources/skeleton/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Grid, GridItem, Skeleton, Switch } from 'daisu-ui';\nimport type { SkeletonRow, SkeletonTheme } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst grid:SkeletonRow[]=[Array.from({length:5},()=>({width:48,height:48})),Array.from({length:5},()=>({width:48,height:16}))];\nconst imageGroup:SkeletonRow[]=[{height:171},1,{width:107},[{width:93},{width:32,marginLeft:41}]];\nexport function SkeletonExample(){\n const [loading,setLoading]=useState(true);\n return <view className=\"demo-skeleton-page\"><DemoGroup title=\"组件类型\">{([['头像骨架屏','avatar'],['图片骨架屏','image'],['文本骨架屏','text'],['段落骨架屏','paragraph']] as [string,SkeletonTheme][]).map(([title,theme])=><ExampleBlock title={title} key={theme}><Skeleton theme={theme}/></ExampleBlock>)}</DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"宫格骨架屏\"><Skeleton rowCol={grid}/></ExampleBlock><ExampleBlock title=\"单元格骨架屏\">{(['circle','rect'] as const).map((type,index)=><view key={type} className={`demo-skeleton-row ${index?'demo-skeleton-row-top':''}`}><Skeleton style={{flexShrink:0}} rowCol={[{size:48,type}]}/><Skeleton style={{width:'100%',marginLeft:'12px'}} rowCol={[{width:'50%'},{width:'100%'}]}/></view>)}</ExampleBlock><ExampleBlock title=\"图片组合骨架屏\"><Skeleton rowCol={imageGroup}/><Skeleton style={{marginTop:'20px'}} rowCol={imageGroup}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"渐变加载动画\"><Skeleton animation=\"gradient\" theme=\"paragraph\"/></ExampleBlock><ExampleBlock title=\"闪烁加载动画\"><view className=\"demo-skeleton-row\"><Skeleton style={{flexShrink:0}} rowCol={[{size:48,type:'circle'}]}/><Skeleton style={{width:'100%',marginLeft:'12px'}} animation=\"flashed\" theme=\"paragraph\"/></view></ExampleBlock><ExampleBlock title=\"插槽内容\"><text className=\"demo-skeleton-switch-label\">切换显示</text><Switch value={loading} onChange={({value})=>{ 'background only';setLoading(Boolean(value)); }}/><view className=\"demo-skeleton-switch-gap\"/><Skeleton loading={loading} rowCol={grid}><Grid>{Array.from({length:5},(_,index)=><GridItem key={index} icon=\"camera\" iconSize={32} text=\"文字\"/>)}</Grid></Skeleton></ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"theme","type":"SkeletonTheme","optional":true,"description":"avatar/image/text/paragraph;预设头像/图片64px,文字16px,段落四行","defaultValue":"'text'","values":["text","image","avatar","paragraph"]},{"name":"rowCol","type":"readonly SkeletonRow[]","optional":true,"description":"readonly SkeletonRow[],非空时替代theme;空数组使用预设"},{"name":"loading","type":"boolean","optional":true,"description":"true只渲染骨架;false只渲染children,无隐藏内容提前挂载","defaultValue":"true","values":[false,true]},{"name":"animation","type":"'' | 'gradient' | 'flashed'","optional":true,"description":"gradient:1.5秒扫光;flashed:2秒明暗变化","defaultValue":"''","values":["","gradient","flashed"]},{"name":"className","type":"string","optional":true,"description":"根节点样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"加载结束内容,原始字符自动包原生text"}],"methods":[],"cssVars":[{"name":"--cso-ui-skeleton-bg","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-skeleton-highlight","defaultValue":"var(--ui-skeleton-highlight)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","基础占位"],"title":"基础占位","section":"组件类型","description":"在数据加载期间展示 `Skeleton`,为即将出现的内容提供结构占位。","language":"tsx","code":"<Skeleton />\n","blocks":[{"language":"tsx","code":"<Skeleton />\n"}]},{"name":"demo-2","aliases":["demo-2","动画与主题"],"title":"动画与主题","section":"组件样式","description":"设置 `animation=\"gradient\"` 使用渐变占位动画。","language":"tsx","code":"<Skeleton animation=\"gradient\" />\n","blocks":[{"language":"tsx","code":"<Skeleton animation=\"gradient\" />\n"}]}],"allowUnknownProps":false},{"name":"Slider","id":"slider","label":"Slider 滑块","category":"录入","categoryId":"form","kind":"component","description":"滑块用于在一个数值范围内选择数值,支持区间值、步长、刻度和垂直布局。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Slider.tsx","docPath":"docs/ui/components/slider.md","doc":"# Slider 滑块\n\n滑块用于在一个数值范围内选择数值,支持区间值、步长、刻度和垂直布局。\n\n```tsx\nimport { Slider } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础滑块\n\n通过 `value` 和 `onChange` 管理滑块值,`min` 和 `max` 指定可选范围。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport type { SliderValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SliderValue>(30);\n\n<Slider value={value} onChange={setValue} min={0} max={100} />\n```\n\n## 组件样式\n\n### 步长与刻度\n\n通过 `step` 设置步长,`marks` 设置刻度,`showValue` 显示当前值。\n\n```tsx\n<Slider\n defaultValue={40}\n step={20}\n marks={[0, 20, 40, 60, 80, 100]}\n showValue\n/>\n```\n\n## 组件状态\n\n### 禁用\n\n设置 `disabled` 禁止拖动滑块。\n\n```tsx\n<Slider value={50} disabled />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | number 或 readonly [number, number],数组自动开启双向范围 | `SliderValue` | — |\n| defaultValue | number 或 readonly [number, number],数组自动开启双向范围 | `SliderValue` | `0` |\n| min | 默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉 | `number` | `0` |\n| max | 默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉 | `number` | `100` |\n| step | 默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉 | `number` | `1` |\n| disabled | 默认 false | `boolean` | — |\n| vertical | 默认 false | `boolean` | `false` |\n| height | 纵向高度,默认 248px | `number` | `248` |\n| theme | default / capsule | `'default' \\| 'capsule'` | `'default'` |\n| showExtremes | 默认 false | `boolean` | `false` |\n| showValue | 拖动时显示值,默认 true | `boolean` | `true` |\n| marks | 数字数组或数字到文字的映射 | `readonly number[] \\| Readonly<Record<number, string>>` | — |\n| className | 根节点样式类 / 无障碍名称 | `string` | `''` |\n| accessibilityLabel | 根节点样式类 / 无障碍名称 | `string` | `'滑块'` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 连续变化 / 拖动结束回调;参数为当前值 | (value: SliderValue) => void |\n| onChangeEnd | 连续变化 / 拖动结束回调;参数为当前值 | (value: SliderValue) => void |\n\n## 数据类型\n\n```tsx\nexport type SliderValue = number | readonly [number, number];\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-control-surface` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Slider 组件源码](./sources/slider/Slider.tsx.txt) · [示例源码](./sources/slider/demo.tsx.txt) · [文档源码](./sources/slider/docs.md.txt)\n","demoSource":"import { Slider } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst marks = [0, 25, 50, 75, 100];\n\nexport function SliderExample() {\n return <view className=\"demo-slider-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\"><Slider defaultValue={30} /></ExampleBlock>\n <ExampleBlock title=\"双向滑块\"><Slider defaultValue={[20, 60]} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用状态\"><Slider defaultValue={70} disabled /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"显示极值\"><Slider defaultValue={25} showExtremes /></ExampleBlock>\n <ExampleBlock title=\"管道样式\"><Slider defaultValue={65} theme=\"capsule\" /></ExampleBlock>\n <ExampleBlock title=\"指定步长\"><Slider defaultValue={30} step={10} /></ExampleBlock>\n <ExampleBlock title=\"指定选择范围\"><Slider defaultValue={5} min={-10} max={10} showExtremes /></ExampleBlock>\n <ExampleBlock title=\"刻度标记\"><Slider defaultValue={50} step={25} marks={marks} /></ExampleBlock>\n <ExampleBlock title=\"刻度标记(管道)\"><Slider defaultValue={50} step={25} marks={marks} theme=\"capsule\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"布局能力\">\n <ExampleBlock title=\"垂直方向\"><view className=\"demo-slider-vertical-row\"><Slider defaultValue={30} vertical /><Slider defaultValue={25} vertical showExtremes /><Slider defaultValue={[20, 60]} vertical /><Slider defaultValue={50} step={25} marks={marks} vertical /></view></ExampleBlock>\n <ExampleBlock title=\"垂直 + 管道\"><view className=\"demo-slider-vertical-row\"><Slider defaultValue={65} vertical theme=\"capsule\" /><Slider defaultValue={[20, 60]} vertical theme=\"capsule\" showExtremes /><Slider defaultValue={50} vertical theme=\"capsule\" step={25} marks={marks} /></view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"value","type":"SliderValue","optional":true,"description":"number 或 readonly [number, number],数组自动开启双向范围"},{"name":"defaultValue","type":"SliderValue","optional":true,"description":"number 或 readonly [number, number],数组自动开启双向范围","defaultValue":"0"},{"name":"min","type":"number","optional":true,"description":"默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉","defaultValue":"0"},{"name":"max","type":"number","optional":true,"description":"默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉","defaultValue":"100"},{"name":"step","type":"number","optional":true,"description":"默认 0 / 100 / 1,步长以 min 为起点,范围手柄不交叉","defaultValue":"1"},{"name":"disabled","type":"boolean","optional":true,"description":"默认 false","values":[false,true]},{"name":"vertical","type":"boolean","optional":true,"description":"默认 false","defaultValue":"false","values":[false,true]},{"name":"height","type":"number","optional":true,"description":"纵向高度,默认 248px","defaultValue":"248"},{"name":"theme","type":"'default' | 'capsule'","optional":true,"description":"default / capsule","defaultValue":"'default'","values":["default","capsule"]},{"name":"showExtremes","type":"boolean","optional":true,"description":"默认 false","defaultValue":"false","values":[false,true]},{"name":"showValue","type":"boolean","optional":true,"description":"拖动时显示值,默认 true","defaultValue":"true","values":[false,true]},{"name":"marks","type":"readonly number[] | Readonly<Record<number, string>>","optional":true,"description":"数字数组或数字到文字的映射"},{"name":"className","type":"string","optional":true,"description":"根节点样式类 / 无障碍名称","defaultValue":"''"},{"name":"accessibilityLabel","type":"string","optional":true,"description":"根节点样式类 / 无障碍名称","defaultValue":"'滑块'"}],"events":[{"name":"onChange","type":"(value: SliderValue) => void","optional":true,"description":"连续变化 / 拖动结束回调;参数为当前值"},{"name":"onChangeEnd","type":"(value: SliderValue) => void","optional":true,"description":"连续变化 / 拖动结束回调;参数为当前值"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-control-surface","defaultValue":"var(--cso-ui-surface)","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","基础滑块"],"title":"基础滑块","section":"组件类型","description":"通过 `value` 和 `onChange` 管理滑块值,`min` 和 `max` 指定可选范围。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { SliderValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SliderValue>(30);\n\n<Slider value={value} onChange={setValue} min={0} max={100} />\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { SliderValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SliderValue>(30);\n\n<Slider value={value} onChange={setValue} min={0} max={100} />\n"}]},{"name":"demo-2","aliases":["demo-2","步长与刻度"],"title":"步长与刻度","section":"组件样式","description":"通过 `step` 设置步长,`marks` 设置刻度,`showValue` 显示当前值。","language":"tsx","code":"<Slider\n defaultValue={40}\n step={20}\n marks={[0, 20, 40, 60, 80, 100]}\n showValue\n/>\n","blocks":[{"language":"tsx","code":"<Slider\n defaultValue={40}\n step={20}\n marks={[0, 20, 40, 60, 80, 100]}\n showValue\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","禁用"],"title":"禁用","section":"组件状态","description":"设置 `disabled` 禁止拖动滑块。","language":"tsx","code":"<Slider value={50} disabled />\n","blocks":[{"language":"tsx","code":"<Slider value={50} disabled />\n"}]}],"allowUnknownProps":false},{"name":"SlideVerify","id":"slide-verify","label":"SlideVerify 滑动验证","category":"录入","categoryId":"form","kind":"component","description":"滑动验证要求用户拖动滑块完成确认,适合表单提交前的交互校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SlideVerify.tsx","docPath":"docs/ui/components/slide-verify.md","doc":"# SlideVerify 滑动验证\n\n滑动验证要求用户拖动滑块完成确认,适合表单提交前的交互校验。\n\n```tsx\nimport { SlideVerify } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 滑动确认\n\n滑块到达确认位置后触发 `onSuccess`。\n\n```tsx\n<SlideVerify\n onSuccess={() => {\n 'background only';\n console.log('验证通过');\n }}\n/>\n```\n\n## 组件状态\n\n### 禁用与自定义文案\n\n设置 `disabled` 禁止拖动,通过 `text` 和 `successText` 设置验证前后的文案。\n\n```tsx\n<SlideVerify disabled />\n<SlideVerify text=\"拖动滑块完成验证\" successText=\"验证成功\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| width | 宽度 | `number \\| string` | `'100%'` |\n| height | 高度 | `number \\| string` | `40` |\n| tolerance | 滑动确认的允许误差 | `number` | `10` |\n| text | 显示文字 | `ReactNode` | `'向右滑动验证'` |\n| successText | successText 配置 | `ReactNode` | `'验证通过'` |\n| disabled | 是否禁用 | `boolean` | — |\n| backgroundColor | 背景颜色 | `string` | — |\n| activeBackgroundColor | 激活状态背景色 | `string` | — |\n| icon | 图标内容 | `string` | `'double-right'` |\n| successIcon | 成功状态图标 | `string` | `'check-circle-fill'` |\n| iconSize | 图标尺寸 | `number` | `20` |\n| successIconSize | 成功状态图标尺寸 | `number` | `20` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onSuccess | 对应操作发生时触发 | () => void |\n| onFail | 对应操作发生时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| text | 显示文字 | ReactNode |\n| successText | 自定义区域内容 | ReactNode |\n| renderIcon | 自定义图标 | ReactNode |\n| renderSuccessIcon | 自定义区域内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| init | 调用实例方法 | () => Promise<void> |\n| reset | 重置状态 | () => void |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[SlideVerify 组件源码](./sources/slide-verify/SlideVerify.tsx.txt) · [示例源码](./sources/slide-verify/demo.tsx.txt) · [文档源码](./sources/slide-verify/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { Button, SlideVerify, Toast, useToast } from 'daisu-ui';\nimport type { SlideVerifyRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function SlideVerifyExample() {\n const ref = useRef<SlideVerifyRef>(null), toast = useToast();\n const feedback = { onSuccess: () => { 'background only'; toast.success('验证成功'); }, onFail: () => { 'background only'; toast.error('验证失败,请重试'); } };\n return <view className=\"demo-slide-verify-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><SlideVerify width=\"calc(100% - 40px)\" {...feedback} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用状态\"><SlideVerify width=\"calc(100% - 40px)\" disabled /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义文案\"><SlideVerify width=\"calc(100% - 40px)\" text=\"请拖动滑块\" successText=\"验证成功\" /></ExampleBlock><ExampleBlock title=\"自定义颜色\"><SlideVerify width=\"calc(100% - 40px)\" backgroundColor=\"var(--cso-ui-primary-soft)\" activeBackgroundColor=\"var(--cso-ui-primary)\" /></ExampleBlock><ExampleBlock title=\"自定义图标\"><SlideVerify width=\"calc(100% - 40px)\" icon=\"arrow-right\" successIcon=\"thumb-up-fill\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"自定义容错范围\"><SlideVerify width=\"calc(100% - 40px)\" tolerance={20} /></ExampleBlock><ExampleBlock title=\"重置方法\"><SlideVerify width=\"calc(100% - 40px)\" ref={ref} {...feedback} /><Button label=\"重置\" className=\"demo-slide-verify-reset\" onTap={() => { 'background only'; ref.current?.reset(); toast.info('已重置'); }} /></ExampleBlock><ExampleBlock title=\"插槽用法\"><SlideVerify width=\"calc(100% - 40px)\" text={<text>滑动验证</text>} successText={<text>验证通过</text>} renderIcon={<text className=\"demo-slide-verify-icon\">drag</text>} renderSuccessIcon={<text className=\"demo-slide-verify-icon demo-slide-verify-success-icon\">OK</text>} /></ExampleBlock></DemoGroup>\n <Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"width","type":"number | string","optional":true,"description":"宽度","defaultValue":"'100%'"},{"name":"height","type":"number | string","optional":true,"description":"高度","defaultValue":"40"},{"name":"tolerance","type":"number","optional":true,"description":"滑动确认的允许误差","defaultValue":"10"},{"name":"text","type":"ReactNode","optional":true,"description":"显示文字","defaultValue":"'向右滑动验证'"},{"name":"successText","type":"ReactNode","optional":true,"description":"自定义区域内容","defaultValue":"'验证通过'"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"backgroundColor","type":"string","optional":true,"description":"背景颜色"},{"name":"activeBackgroundColor","type":"string","optional":true,"description":"激活状态背景色"},{"name":"icon","type":"string","optional":true,"description":"图标内容","defaultValue":"'double-right'"},{"name":"successIcon","type":"string","optional":true,"description":"成功状态图标","defaultValue":"'check-circle-fill'"},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸","defaultValue":"20"},{"name":"successIconSize","type":"number","optional":true,"description":"成功状态图标尺寸","defaultValue":"20"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onSuccess","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onFail","type":"() => void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"text","type":"ReactNode","optional":true,"description":"显示文字","defaultValue":"'向右滑动验证'"},{"name":"successText","type":"ReactNode","optional":true,"description":"自定义区域内容","defaultValue":"'验证通过'"},{"name":"renderIcon","type":"ReactNode","optional":true,"description":"自定义图标"},{"name":"renderSuccessIcon","type":"ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"init","description":"调用实例方法","type":"() => Promise<void>"},{"name":"reset","description":"重置状态","type":"() => void"}],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","滑动确认"],"title":"滑动确认","section":"基础用法","description":"滑块到达确认位置后触发 `onSuccess`。","language":"tsx","code":"<SlideVerify\n onSuccess={() => {\n 'background only';\n console.log('验证通过');\n }}\n/>\n","blocks":[{"language":"tsx","code":"<SlideVerify\n onSuccess={() => {\n 'background only';\n console.log('验证通过');\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用与自定义文案"],"title":"禁用与自定义文案","section":"组件状态","description":"设置 `disabled` 禁止拖动,通过 `text` 和 `successText` 设置验证前后的文案。","language":"tsx","code":"<SlideVerify disabled />\n<SlideVerify text=\"拖动滑块完成验证\" successText=\"验证成功\" />\n","blocks":[{"language":"tsx","code":"<SlideVerify disabled />\n<SlideVerify text=\"拖动滑块完成验证\" successText=\"验证成功\" />\n"}]}],"allowUnknownProps":false},{"name":"SortButton","id":"sort-button","label":"SortButton 排序按钮","category":"数据展示","categoryId":"display","kind":"component","description":"排序按钮循环切换默认、升序和降序状态,适合列表与表格的排序入口。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SortButton.tsx","docPath":"docs/ui/components/sort-button.md","doc":"# SortButton 排序按钮\n\n排序按钮循环切换默认、升序和降序状态,适合列表与表格的排序入口。\n\n```tsx\nimport { SortButton } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 受控排序\n\n通过 `title` 设置文案,`value` 和 `onChange` 管理当前排序状态。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport type { SortButtonValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SortButtonValue>(0);\n\n<SortButton\n title=\"价格\"\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n```\n\n## 组件样式\n\n### 默认降序\n\n设置 `descFirst`,第一次切换时优先使用降序。\n\n```tsx\n<SortButton title=\"销量\" descFirst />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `SortButtonValue` | — |\n| defaultValue | 非受控模式的初始值 | `SortButtonValue` | `0` |\n| title | 标题内容 | `string` | `''` |\n| allowReset | 是否允许回到默认排序 | `boolean` | `false` |\n| descFirst | 是否优先切换到降序 | `boolean` | `false` |\n| line | 是否展示排序线条 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: SortButtonValue }) => void |\n\n## 数据类型\n\n```tsx\nexport type SortButtonValue = -1 | 0 | 1;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n| `--cso-ui-text-secondary` | 共享主题 |\n\n## 源代码\n\n[SortButton 组件源码](./sources/sort-button/SortButton.tsx.txt) · [示例源码](./sources/sort-button/demo.tsx.txt) · [文档源码](./sources/sort-button/docs.md.txt)\n","demoSource":"import { SortButton } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function SortButtonExample() {\n return <view className=\"demo-sort-button-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基础用法\"><SortButton title=\"价格\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"设置 allow-reset 允许重置按钮\"><SortButton title=\"价格\" allowReset /></ExampleBlock>\n <ExampleBlock title=\"设置 desc-first 优先切换为降序\"><SortButton title=\"价格\" descFirst /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"显示下划线\"><SortButton title=\"价格\" line /></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"value","type":"SortButtonValue","optional":true,"description":"当前值;传入后由调用方更新","values":[0,1,-1]},{"name":"defaultValue","type":"SortButtonValue","optional":true,"description":"非受控模式的初始值","defaultValue":"0","values":[0,1,-1]},{"name":"title","type":"string","optional":true,"description":"标题内容","defaultValue":"''"},{"name":"allowReset","type":"boolean","optional":true,"description":"是否允许回到默认排序","defaultValue":"false","values":[false,true]},{"name":"descFirst","type":"boolean","optional":true,"description":"是否优先切换到降序","defaultValue":"false","values":[false,true]},{"name":"line","type":"boolean","optional":true,"description":"是否展示排序线条","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(event: { value: SortButtonValue }) => void","optional":true,"description":"值发生变化时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-secondary","defaultValue":"var(--cso-ui-text-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","受控排序"],"title":"受控排序","section":"基础用法","description":"通过 `title` 设置文案,`value` 和 `onChange` 管理当前排序状态。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { SortButtonValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SortButtonValue>(0);\n\n<SortButton\n title=\"价格\"\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport type { SortButtonValue } from 'daisu-ui';\n\nconst [value, setValue] = useState<SortButtonValue>(0);\n\n<SortButton\n title=\"价格\"\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","默认降序"],"title":"默认降序","section":"组件样式","description":"设置 `descFirst`,第一次切换时优先使用降序。","language":"tsx","code":"<SortButton title=\"销量\" descFirst />\n","blocks":[{"language":"tsx","code":"<SortButton title=\"销量\" descFirst />\n"}]}],"allowUnknownProps":false},{"name":"Step","id":"steps","label":"Steps 步骤条","category":"数据展示","categoryId":"display","kind":"component","description":"步骤条用于展示任务流程和当前进度,支持方向、状态与自定义图标内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Steps.tsx","docPath":"docs/ui/components/steps.md","doc":"# Steps 步骤条\n\n步骤条用于展示任务流程和当前进度,支持方向、状态与自定义图标内容。\n\n```tsx\nimport { Steps, Step } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 水平步骤条\n\n在 `Steps` 中组合 `Step`,通过 `active` 指定当前步骤索引。\n\n```tsx\n<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n```\n\n## 布局能力\n\n### 垂直步骤条\n\n设置 `vertical` 使用垂直排列,通过 `description` 设置步骤补充说明。\n\n```tsx\n<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n```\n\n## Attributes 属性\n\n### Steps\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| active | 当前步骤或激活状态 | `number` | `0` |\n| vertical | 是否垂直排列 | `boolean` | `false` |\n| dot | 是否显示圆点 | `boolean` | `false` |\n| space | 相邻项间距 | `number \\| string` | — |\n| alignCenter | 是否居中对齐 | `boolean` | `false` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### Step\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `ReactNode` | — |\n| description | 补充描述 | `ReactNode` | — |\n| icon | 图标内容 | `ReactNode` | — |\n| status | 当前状态 | `StepStatus` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Steps.children | 自定义内容 | ReactNode |\n| Step.title | 标题内容 | ReactNode |\n| Step.description | 补充描述 | ReactNode |\n| Step.icon | 图标内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type StepStatus = 'finished' | 'process' | 'wait' | 'error';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-step-dot-finished-bg` | 共享主题 |\n| `--cso-ui-step-finished-bg` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Steps 组件源码](./sources/steps/Steps.tsx.txt) · [Step 组件源码](./sources/steps/Steps.tsx.txt) · [示例源码](./sources/steps/demo.tsx.txt) · [文档源码](./sources/steps/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Steps, Step, ConfigProvider, useConfigProvider } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function StepsExample(){\n const {theme}=useConfigProvider();\n const [active,setActive]=useState(0),[dots,setDots]=useState(0),[vertical,setVertical]=useState(0);\n const rows=(word='注册1个账号')=>[word,'登录账号并绑定手机','完善个人信息'].map((description,index)=><Step key={index} title={`步骤${index+1}`} description={description}/>);\n const next=(action:()=>void)=><view className=\"demo-steps-action\"><Button size=\"small\" onTap={action} label=\"下一步\"/></view>;\n return <ConfigProvider className=\"demo-steps-page\" themeVars={{primary:theme==='dark'?'#5b90ff':'#1c64fd',danger:theme==='dark'?'#ff6b6b':'#f14646'}}><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Steps><Step/><Step/><Step/></Steps></ExampleBlock><ExampleBlock title=\"标题和描述信息\"><Steps active={active} alignCenter>{rows()}</Steps>{next(()=>{ 'background only';setActive(value=>value+1); })}</ExampleBlock><ExampleBlock title=\"修改图标\"><Steps active={1} alignCenter><Step icon=\"settings\"/><Step icon=\"list\"/><Step icon=\"clock-circle\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"修改状态\"><Steps active={1} alignCenter><Step title=\"绑定手机\"/><Step title=\"重新绑定手机\" status=\"error\"/><Step title=\"步骤3\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"水平局中\"><Steps alignCenter><Step/><Step/><Step/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\"><ExampleBlock title=\"竖向步骤条\"><Steps active={1} vertical><Step description=\"注册1个账号\"/><Step description=\"登录账号并绑定手机,后面是比较长的文案,后面是比较长的文案\"/><Step description=\"完善个人信息\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"点状步骤条\"><Steps active={1} dot alignCenter>{rows()}</Steps></ExampleBlock><ExampleBlock title=\"可控制的点状步骤条\"><Steps active={dots} dot alignCenter>{rows('注册一个账号')}</Steps>{next(()=>{ 'background only';setDots(value=>(value+1)%4); })}</ExampleBlock><ExampleBlock title=\"点状步骤和垂直方向\"><Steps active={1} vertical dot><Step description=\"注册1个账号\"/><Step description=\"登录账号并绑定手机\"/><Step description=\"完善个人信息\"/></Steps></ExampleBlock><ExampleBlock title=\"可控制的竖向点状步骤条\"><Steps active={vertical} vertical dot>{rows('注册一个账号')}</Steps>{next(()=>{ 'background only';setVertical(value=>(value+1)%4); })}</ExampleBlock></DemoGroup></ConfigProvider>;\n}\n","props":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"description","type":"ReactNode","optional":true,"description":"补充描述"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"},{"name":"status","type":"StepStatus","optional":true,"description":"当前状态","values":["error","finished","process","wait"]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"title","type":"ReactNode","optional":true,"description":"标题内容"},{"name":"description","type":"ReactNode","optional":true,"description":"补充描述"},{"name":"icon","type":"ReactNode","optional":true,"description":"图标内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-step-dot-finished-bg","defaultValue":"#b8cfff","description":""},{"name":"--cso-ui-step-finished-bg","defaultValue":"#f5f8ff","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","水平步骤条"],"title":"水平步骤条","section":"组件类型","description":"在 `Steps` 中组合 `Step`,通过 `active` 指定当前步骤索引。","language":"tsx","code":"<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n","blocks":[{"language":"tsx","code":"<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n"}]},{"name":"demo-2","aliases":["demo-2","垂直步骤条"],"title":"垂直步骤条","section":"布局能力","description":"设置 `vertical` 使用垂直排列,通过 `description` 设置步骤补充说明。","language":"tsx","code":"<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n","blocks":[{"language":"tsx","code":"<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n"}]}],"allowUnknownProps":false},{"name":"Steps","id":"steps","label":"Steps 步骤条","category":"数据展示","categoryId":"display","kind":"component","description":"步骤条用于展示任务流程和当前进度,支持方向、状态与自定义图标内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Steps.tsx","docPath":"docs/ui/components/steps.md","doc":"# Steps 步骤条\n\n步骤条用于展示任务流程和当前进度,支持方向、状态与自定义图标内容。\n\n```tsx\nimport { Steps, Step } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 水平步骤条\n\n在 `Steps` 中组合 `Step`,通过 `active` 指定当前步骤索引。\n\n```tsx\n<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n```\n\n## 布局能力\n\n### 垂直步骤条\n\n设置 `vertical` 使用垂直排列,通过 `description` 设置步骤补充说明。\n\n```tsx\n<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n```\n\n## Attributes 属性\n\n### Steps\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| active | 当前步骤或激活状态 | `number` | `0` |\n| vertical | 是否垂直排列 | `boolean` | `false` |\n| dot | 是否显示圆点 | `boolean` | `false` |\n| space | 相邻项间距 | `number \\| string` | — |\n| alignCenter | 是否居中对齐 | `boolean` | `false` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### Step\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | 标题内容 | `ReactNode` | — |\n| description | 补充描述 | `ReactNode` | — |\n| icon | 图标内容 | `ReactNode` | — |\n| status | 当前状态 | `StepStatus` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Steps.children | 自定义内容 | ReactNode |\n| Step.title | 标题内容 | ReactNode |\n| Step.description | 补充描述 | ReactNode |\n| Step.icon | 图标内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type StepStatus = 'finished' | 'process' | 'wait' | 'error';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-step-dot-finished-bg` | 共享主题 |\n| `--cso-ui-step-finished-bg` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Steps 组件源码](./sources/steps/Steps.tsx.txt) · [Step 组件源码](./sources/steps/Steps.tsx.txt) · [示例源码](./sources/steps/demo.tsx.txt) · [文档源码](./sources/steps/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Steps, Step, ConfigProvider, useConfigProvider } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function StepsExample(){\n const {theme}=useConfigProvider();\n const [active,setActive]=useState(0),[dots,setDots]=useState(0),[vertical,setVertical]=useState(0);\n const rows=(word='注册1个账号')=>[word,'登录账号并绑定手机','完善个人信息'].map((description,index)=><Step key={index} title={`步骤${index+1}`} description={description}/>);\n const next=(action:()=>void)=><view className=\"demo-steps-action\"><Button size=\"small\" onTap={action} label=\"下一步\"/></view>;\n return <ConfigProvider className=\"demo-steps-page\" themeVars={{primary:theme==='dark'?'#5b90ff':'#1c64fd',danger:theme==='dark'?'#ff6b6b':'#f14646'}}><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Steps><Step/><Step/><Step/></Steps></ExampleBlock><ExampleBlock title=\"标题和描述信息\"><Steps active={active} alignCenter>{rows()}</Steps>{next(()=>{ 'background only';setActive(value=>value+1); })}</ExampleBlock><ExampleBlock title=\"修改图标\"><Steps active={1} alignCenter><Step icon=\"settings\"/><Step icon=\"list\"/><Step icon=\"clock-circle\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"修改状态\"><Steps active={1} alignCenter><Step title=\"绑定手机\"/><Step title=\"重新绑定手机\" status=\"error\"/><Step title=\"步骤3\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"水平局中\"><Steps alignCenter><Step/><Step/><Step/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"布局能力\"><ExampleBlock title=\"竖向步骤条\"><Steps active={1} vertical><Step description=\"注册1个账号\"/><Step description=\"登录账号并绑定手机,后面是比较长的文案,后面是比较长的文案\"/><Step description=\"完善个人信息\"/></Steps></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"点状步骤条\"><Steps active={1} dot alignCenter>{rows()}</Steps></ExampleBlock><ExampleBlock title=\"可控制的点状步骤条\"><Steps active={dots} dot alignCenter>{rows('注册一个账号')}</Steps>{next(()=>{ 'background only';setDots(value=>(value+1)%4); })}</ExampleBlock><ExampleBlock title=\"点状步骤和垂直方向\"><Steps active={1} vertical dot><Step description=\"注册1个账号\"/><Step description=\"登录账号并绑定手机\"/><Step description=\"完善个人信息\"/></Steps></ExampleBlock><ExampleBlock title=\"可控制的竖向点状步骤条\"><Steps active={vertical} vertical dot>{rows('注册一个账号')}</Steps>{next(()=>{ 'background only';setVertical(value=>(value+1)%4); })}</ExampleBlock></DemoGroup></ConfigProvider>;\n}\n","props":[{"name":"active","type":"number","optional":true,"description":"当前步骤或激活状态","defaultValue":"0"},{"name":"vertical","type":"boolean","optional":true,"description":"是否垂直排列","defaultValue":"false","values":[false,true]},{"name":"dot","type":"boolean","optional":true,"description":"是否显示圆点","defaultValue":"false","values":[false,true]},{"name":"space","type":"number | string","optional":true,"description":"相邻项间距"},{"name":"alignCenter","type":"boolean","optional":true,"description":"是否居中对齐","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-step-dot-finished-bg","defaultValue":"#b8cfff","description":""},{"name":"--cso-ui-step-finished-bg","defaultValue":"#f5f8ff","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","水平步骤条"],"title":"水平步骤条","section":"组件类型","description":"在 `Steps` 中组合 `Step`,通过 `active` 指定当前步骤索引。","language":"tsx","code":"<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n","blocks":[{"language":"tsx","code":"<Steps active={1}>\n <Step title=\"已下单\" />\n <Step title=\"运输中\" />\n <Step title=\"已完成\" />\n</Steps>\n"}]},{"name":"demo-2","aliases":["demo-2","垂直步骤条"],"title":"垂直步骤条","section":"布局能力","description":"设置 `vertical` 使用垂直排列,通过 `description` 设置步骤补充说明。","language":"tsx","code":"<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n","blocks":[{"language":"tsx","code":"<Steps active={1} vertical>\n <Step title=\"提交申请\" description=\"资料已提交\" />\n <Step title=\"审核中\" description=\"请耐心等待\" />\n</Steps>\n"}]}],"allowUnknownProps":false},{"name":"Sticky","id":"sticky","label":"Sticky 粘性布局","category":"数据展示","categoryId":"display","kind":"component","description":"吸顶组件在滚动时将内容固定在容器顶部,适合分类标题、筛选栏和操作区。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Sticky.tsx","docPath":"docs/ui/components/sticky.md","doc":"# Sticky 粘性布局\n\n吸顶组件在滚动时将内容固定在容器顶部,适合分类标题、筛选栏和操作区。\n\n```tsx\nimport { Sticky, StickyBox } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 吸顶内容\n\n使用 `StickyBox` 包裹内容区域,`Sticky` 中放置需要吸顶的内容。\n\n```tsx\n<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n```\n\n## 组件样式\n\n### 顶部偏移\n\n通过 `offsetTop` 设置吸顶时与顶部的距离,为导航栏等内容保留空间。\n\n```tsx\n<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n```\n\n## Attributes 属性\n\n### Sticky\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| offsetTop | 顶部偏移距离 | `number` | `0` |\n| zIndex | 浮层层级 | `number` | `1` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### StickyBox\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Sticky.children | 自定义内容 | ReactNode |\n| StickyBox.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Sticky 组件源码](./sources/sticky/Sticky.tsx.txt) · [StickyBox 组件源码](./sources/sticky/Sticky.tsx.txt) · [示例源码](./sources/sticky/demo.tsx.txt) · [文档源码](./sources/sticky/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Button, Sticky, StickyBox } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function StickyExample(){\n const [show,setShow]=useState(false);\n useEffect(()=>{const timer=setTimeout(()=>setShow(true),5000);return()=>clearTimeout(timer);},[]);\n return <view className=\"demo-sticky-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-sticky-container\"><Sticky offsetTop={44} style={{marginLeft:'20px'}}><Button tone=\"success\" label=\"基础用法\"/></Sticky></view></ExampleBlock><ExampleBlock title=\"相对容器\"><view className=\"demo-sticky-container\"><StickyBox><view className=\"demo-sticky-box\"><Sticky offsetTop={44}><Button tone=\"warning\" label=\"相对容器\"/></Sticky></view></StickyBox></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"吸顶距离\"><view className=\"demo-sticky-container\"><Sticky offsetTop={94}><Button label=\"吸顶距离\"/></Sticky></view></ExampleBlock><ExampleBlock title=\"相对容器+吸顶距离\"><view className=\"demo-sticky-container\"><StickyBox><view className=\"demo-sticky-box\"><Sticky offsetTop={194}><Button tone=\"warning\" label=\"相对容器+吸顶距离\"/></Sticky></view></StickyBox></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"动态插入\"><view className=\"demo-sticky-container demo-sticky-dynamic\"><Button tone=\"info\" variant=\"plain\" label=\"点击插入\" onTap={()=>{ 'background only';setShow(true); }}/><Sticky offsetTop={44} style={{marginTop:show?0:'24px'}}>{show?<Button tone=\"danger\" label=\"动态生成\"/>:null}</Sticky></view></ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"offsetTop","type":"number","optional":true,"description":"顶部偏移距离","defaultValue":"0"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"1"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","吸顶内容"],"title":"吸顶内容","section":"基础用法","description":"使用 `StickyBox` 包裹内容区域,`Sticky` 中放置需要吸顶的内容。","language":"tsx","code":"<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n","blocks":[{"language":"tsx","code":"<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n"}]},{"name":"demo-2","aliases":["demo-2","顶部偏移"],"title":"顶部偏移","section":"组件样式","description":"通过 `offsetTop` 设置吸顶时与顶部的距离,为导航栏等内容保留空间。","language":"tsx","code":"<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n","blocks":[{"language":"tsx","code":"<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n"}]}],"allowUnknownProps":false},{"name":"StickyBox","id":"sticky","label":"Sticky 粘性布局","category":"数据展示","categoryId":"display","kind":"component","description":"吸顶组件在滚动时将内容固定在容器顶部,适合分类标题、筛选栏和操作区。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Sticky.tsx","docPath":"docs/ui/components/sticky.md","doc":"# Sticky 粘性布局\n\n吸顶组件在滚动时将内容固定在容器顶部,适合分类标题、筛选栏和操作区。\n\n```tsx\nimport { Sticky, StickyBox } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 吸顶内容\n\n使用 `StickyBox` 包裹内容区域,`Sticky` 中放置需要吸顶的内容。\n\n```tsx\n<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n```\n\n## 组件样式\n\n### 顶部偏移\n\n通过 `offsetTop` 设置吸顶时与顶部的距离,为导航栏等内容保留空间。\n\n```tsx\n<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n```\n\n## Attributes 属性\n\n### Sticky\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| offsetTop | 顶部偏移距离 | `number` | `0` |\n| zIndex | 浮层层级 | `number` | `1` |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n### StickyBox\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Sticky.children | 自定义内容 | ReactNode |\n| StickyBox.children | 自定义内容 | ReactNode |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Sticky 组件源码](./sources/sticky/Sticky.tsx.txt) · [StickyBox 组件源码](./sources/sticky/Sticky.tsx.txt) · [示例源码](./sources/sticky/demo.tsx.txt) · [文档源码](./sources/sticky/docs.md.txt)\n","demoSource":"import { useEffect, useState } from '@lynx-js/react';\nimport { Button, Sticky, StickyBox } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nexport function StickyExample(){\n const [show,setShow]=useState(false);\n useEffect(()=>{const timer=setTimeout(()=>setShow(true),5000);return()=>clearTimeout(timer);},[]);\n return <view className=\"demo-sticky-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-sticky-container\"><Sticky offsetTop={44} style={{marginLeft:'20px'}}><Button tone=\"success\" label=\"基础用法\"/></Sticky></view></ExampleBlock><ExampleBlock title=\"相对容器\"><view className=\"demo-sticky-container\"><StickyBox><view className=\"demo-sticky-box\"><Sticky offsetTop={44}><Button tone=\"warning\" label=\"相对容器\"/></Sticky></view></StickyBox></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"吸顶距离\"><view className=\"demo-sticky-container\"><Sticky offsetTop={94}><Button label=\"吸顶距离\"/></Sticky></view></ExampleBlock><ExampleBlock title=\"相对容器+吸顶距离\"><view className=\"demo-sticky-container\"><StickyBox><view className=\"demo-sticky-box\"><Sticky offsetTop={194}><Button tone=\"warning\" label=\"相对容器+吸顶距离\"/></Sticky></view></StickyBox></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"动态插入\"><view className=\"demo-sticky-container demo-sticky-dynamic\"><Button tone=\"info\" variant=\"plain\" label=\"点击插入\" onTap={()=>{ 'background only';setShow(true); }}/><Sticky offsetTop={44} style={{marginTop:show?0:'24px'}}>{show?<Button tone=\"danger\" label=\"动态生成\"/>:null}</Sticky></view></ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","吸顶内容"],"title":"吸顶内容","section":"基础用法","description":"使用 `StickyBox` 包裹内容区域,`Sticky` 中放置需要吸顶的内容。","language":"tsx","code":"<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n","blocks":[{"language":"tsx","code":"<StickyBox>\n <Sticky>\n <view style={{ height: '48px' }}>\n <text>吸顶标题</text>\n </view>\n </Sticky>\n <view style={{ height: '800px' }}>\n <text>滚动内容</text>\n </view>\n</StickyBox>\n"}]},{"name":"demo-2","aliases":["demo-2","顶部偏移"],"title":"顶部偏移","section":"组件样式","description":"通过 `offsetTop` 设置吸顶时与顶部的距离,为导航栏等内容保留空间。","language":"tsx","code":"<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n","blocks":[{"language":"tsx","code":"<Sticky offsetTop={44}>\n <text>为导航栏预留位置</text>\n</Sticky>\n"}]}],"allowUnknownProps":false},{"name":"SwipeAction","id":"swipe-action","label":"SwipeAction 滑动操作","category":"反馈","categoryId":"feedback","kind":"component","description":"滑动操作通过左右滑动展示快捷操作,适合列表中的删除、收藏等操作入口。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SwipeAction.tsx","docPath":"docs/ui/components/swipe-action.md","doc":"# SwipeAction 滑动操作\n\n滑动操作通过左右滑动展示快捷操作,适合列表中的删除、收藏等操作入口。\n\n```tsx\nimport { SwipeAction } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 右侧操作\n\n通过 `right` 设置向左滑动后展示的操作区,子节点作为列表内容。\n\n```tsx\nimport { Button, Cell } from 'daisu-ui';\n\n<SwipeAction right={<Button label=\"删除\" tone=\"danger\" />}>\n <Cell title=\"向左滑动\" value=\"展示操作\" />\n</SwipeAction>\n```\n\n## 组件状态\n\n### 禁用滑动\n\n设置 `disabled` 禁止展开滑动操作区。\n\n```tsx\n<SwipeAction disabled right={<Button label=\"删除\" />}>\n <Cell title=\"禁用滑动\" />\n</SwipeAction>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `SwipeActionStatus` | — |\n| defaultValue | 非受控模式的初始值 | `SwipeActionStatus` | `'close'` |\n| disabled | 是否禁用 | `boolean` | `false` |\n| beforeClose | 关闭前校验 | `SwipeActionBeforeClose` | — |\n| left | 左侧内容 | `ReactNode` | — |\n| right | 右侧内容 | `ReactNode` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| duration | 动画或显示时长,单位 ms | `number` | `600` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (value: SwipeActionStatus) => void |\n| onClick | 点击时触发 | (event: SwipeActionClickEvent) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| left | 左侧内容 | ReactNode |\n| right | 右侧内容 | ReactNode |\n| children | 自定义内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| close | 关闭面板 | (reason?: SwipeActionReason, position?: SwipeActionPosition) => Promise<boolean> |\n\n## 数据类型\n\n```tsx\nexport type SwipeActionStatus = 'left' | 'close' | 'right';\n\nexport type SwipeActionBeforeClose = (\n reason: SwipeActionReason,\n position: SwipeActionPosition,\n) => boolean | Promise<boolean>;\n\nexport type SwipeActionClickEvent = { value: SwipeActionPosition };\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[SwipeAction 组件源码](./sources/swipe-action/SwipeAction.tsx.txt) · [示例源码](./sources/swipe-action/demo.tsx.txt) · [文档源码](./sources/swipe-action/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Button, Cell, SwipeAction, Toast, useToast } from 'daisu-ui';\nimport type { SwipeActionBeforeClose, SwipeActionRef, SwipeActionStatus } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function SwipeActionExample() {\n const toast = useToast();\n const refs = useRef<Record<string, SwipeActionRef | null>>({});\n const [value, setValue] = useState<SwipeActionStatus>('close');\n const waiting = useRef<{ timer: ReturnType<typeof setTimeout>; resolve: (value: boolean) => void }>();\n useEffect(() => () => { clearTimeout(waiting.current?.timer); waiting.current?.resolve(false); }, []);\n const closeAll = (except?: string) => { 'background only'; for (const [key, ref] of Object.entries(refs.current)) if (key !== except) void ref?.close('value'); };\n const props = (key: string) => ({ ref: (ref: SwipeActionRef | null) => { 'background only'; refs.current[key] = ref; }, onChange: (next: SwipeActionStatus) => { 'background only'; if (key === 'controlled') setValue(next); if (next !== 'close') closeAll(key); } });\n const actions = (labels: string[], feedback = true) => <view className=\"demo-swipe-actions\">{labels.map((label, index) => <view key={label} className={`demo-swipe-button demo-swipe-button-${index % 3}`} bindtap={feedback ? () => toast.show(`点击了${label}`) : undefined}><text>{label}</text></view>)}</view>;\n const beforeClose: SwipeActionBeforeClose = (reason, position) => {\n 'background only';\n if (reason === 'click' && position === 'inside') { toast.show('已拦截点击内容区导致的关闭'); return false; }\n toast.loading('处理中...');\n return new Promise(resolve => {\n clearTimeout(waiting.current?.timer); waiting.current?.resolve(false);\n waiting.current = { resolve, timer: setTimeout(() => {\n waiting.current = undefined; toast.close();\n toast.show(reason === 'click' ? `${reason} ${position} 导致滑动按钮关闭` : `${reason} 导致 ${position} 滑动按钮关闭`); resolve(true);\n }, 3000) };\n });\n };\n const cell = (label = '内容') => <Cell title=\"标题文字\" value={label} />;\n return <view className=\"demo-swipe-page\" bindtap={() => closeAll()}>\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\" noPadding><SwipeAction {...props('basic')} right={actions(['操作1', '操作2', '操作3'])}>{cell()}</SwipeAction></ExampleBlock>\n <ExampleBlock title=\"左右滑动\" noPadding><SwipeAction {...props('both')} left={actions(['操作1', '操作2', '操作3'])} right={actions(['操作4', '操作5', '操作6'])}>{cell()}</SwipeAction></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"禁用滑动按钮\" noPadding><SwipeAction disabled right={actions(['操作1', '操作2', '操作3'])}>{cell()}</SwipeAction></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"切换按钮\" noPadding><SwipeAction {...props('controlled')} value={value} left={actions(['操作1', '操作2', '操作3'])} right={actions(['操作4', '操作5', '操作6'])}>{cell()}</SwipeAction><view className=\"demo-swipe-controls\" catchtap={() => {}}>{(['left', 'close', 'right'] as const).map((status, index) => <Button key={status} label={['打开左边', '关闭所有', '打开右边'][index]} size=\"small\" onTap={() => { 'background only'; closeAll('controlled'); setValue(status); }} />)}</view></ExampleBlock>\n <ExampleBlock title=\"关闭前拦截\" noPadding><SwipeAction {...props('guard')} beforeClose={beforeClose} right={actions(['删除', '标记'], false)}>{cell('阻止点击内容区关闭')}</SwipeAction></ExampleBlock>\n <ExampleBlock title=\"点击事件\" noPadding><SwipeAction {...props('click')} onClick={({ value }) => toast.show(`点击 ${value} 关闭操作按钮`)} right={actions(['操作1', '操作2', '操作3'], false)}>{cell()}</SwipeAction></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"value","type":"SwipeActionStatus","optional":true,"description":"当前值;传入后由调用方更新","values":["left","right","close"]},{"name":"defaultValue","type":"SwipeActionStatus","optional":true,"description":"非受控模式的初始值","defaultValue":"'close'","values":["left","right","close"]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","defaultValue":"false","values":[false,true]},{"name":"beforeClose","type":"SwipeActionBeforeClose","optional":true,"description":"关闭前校验"},{"name":"left","type":"ReactNode","optional":true,"description":"左侧内容"},{"name":"right","type":"ReactNode","optional":true,"description":"右侧内容"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"600"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(value: SwipeActionStatus) => void","optional":true,"description":"值发生变化时触发"},{"name":"onClick","type":"(event: SwipeActionClickEvent) => void","optional":true,"description":"点击时触发"}],"slots":[{"name":"left","type":"ReactNode","optional":true,"description":"左侧内容"},{"name":"right","type":"ReactNode","optional":true,"description":"右侧内容"},{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[{"name":"close","description":"关闭面板","type":"(reason?: SwipeActionReason, position?: SwipeActionPosition) => Promise<boolean>"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","右侧操作"],"title":"右侧操作","section":"基础用法","description":"通过 `right` 设置向左滑动后展示的操作区,子节点作为列表内容。","language":"tsx","code":"import { Button, Cell } from 'daisu-ui';\n\n<SwipeAction right={<Button label=\"删除\" tone=\"danger\" />}>\n <Cell title=\"向左滑动\" value=\"展示操作\" />\n</SwipeAction>\n","blocks":[{"language":"tsx","code":"import { Button, Cell } from 'daisu-ui';\n\n<SwipeAction right={<Button label=\"删除\" tone=\"danger\" />}>\n <Cell title=\"向左滑动\" value=\"展示操作\" />\n</SwipeAction>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用滑动"],"title":"禁用滑动","section":"组件状态","description":"设置 `disabled` 禁止展开滑动操作区。","language":"tsx","code":"<SwipeAction disabled right={<Button label=\"删除\" />}>\n <Cell title=\"禁用滑动\" />\n</SwipeAction>\n","blocks":[{"language":"tsx","code":"<SwipeAction disabled right={<Button label=\"删除\" />}>\n <Cell title=\"禁用滑动\" />\n</SwipeAction>\n"}]}],"allowUnknownProps":false},{"name":"Swiper","id":"swiper","label":"Swiper 轮播图","category":"数据展示","categoryId":"display","kind":"component","description":"轮播图用于在固定区域切换图片或自定义内容,支持自动播放、指示器和滑动控制。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Swiper.tsx","docPath":"docs/ui/components/swiper.md","doc":"# Swiper 轮播图\n\n轮播图用于在固定区域切换图片或自定义内容,支持自动播放、指示器和滑动控制。\n\n```tsx\nimport { Swiper, SwiperNav } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 图片轮播\n\n通过 `list` 设置图片地址列表,通过 `height` 设置轮播区域高度。\n\n```tsx\n<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n```\n\n## 交互用法\n\n### 关闭自动播放\n\n设置 `autoplay={false}` 关闭自动播放,通过 `onChange` 获取切换结果。\n\n```tsx\n<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n```\n\n## 内容形态\n\n### 自定义轮播项\n\n通过 `renderItem` 自定义每一项的内容。\n\n```tsx\n<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n```\n\n## Attributes 属性\n\n### Swiper\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| list | 图片地址或对象列表;空列表不创建分页内核 | `readonly SwiperItem[]` | 必填 |\n| current | current 为受控值;未传时使用内部状态 | `number` | — |\n| defaultCurrent | current 为受控值;未传时使用内部状态 | `number` | `0` |\n| autoplay | 自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时 | `boolean` | `true` |\n| interval | 自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时 | `number` | `5000` |\n| duration | 原生动画时长 ms;非循环到末项后停止自动播放 | `number` | `300` |\n| loop | 原生动画时长 ms;非循环到末项后停止自动播放 | `boolean` | `true` |\n| height | 数字为 px;字符串按 Img 尺寸规则处理 | `number\\|string` | `192` |\n| displayMultipleItems | 同时显示数量,归一为 1 到列表长度间的整数 | `number` | `1` |\n| previousMargin | 两侧留白,单位 px;不接受 CSS 字符串或 rpx | `number` | `0` |\n| nextMargin | 两侧留白,单位 px;不接受 CSS 字符串或 rpx | `number` | `0` |\n| neighborHeight | 邻项高度 px;启用原生进度卡片动画,限制在 0 到当前轮播高度间,不再叠加图片 height 过渡 | `number` | — |\n| indicator | false 隐藏;对象包含 type、minShowNum、showControls | `boolean\\|SwiperIndicator` | `true` |\n| indicatorPosition | left、top-left、top、top-right、bottom-left、bottom、bottom-right、right | `'left'\\|'top-left'\\|'top'\\|'top-right'\\|'bottom-left'\\|'bottom'\\|'bottom-right'\\|'right'` | `'bottom'` |\n| valueKey | 对象中的图片地址和右上角标题字段 | `string` | `'value'` |\n| textKey | 对象中的图片地址和右上角标题字段 | `string` | `'text'` |\n| imageMode | 使用公共 Img 支持的模式 | `ImgMode` | `'aspectFill'` |\n| customIndicatorClass | 指示器与所有项目的样式类 | `string` | `''` |\n| customItemClass | 指示器与所有项目的样式类 | `string` | `''` |\n| customPrevClass | 前一项、后一项的样式类,可实现卡片效果 | `string` | `''` |\n| customNextClass | 前一项、后一项的样式类,可实现卡片效果 | `string` | `''` |\n| customTextClass | 标题样式 | `string` | `''` |\n| customTextStyle | 标题样式 | `CSSProperties` | — |\n| className | 外层样式 | `string` | `''` |\n| style | 外层样式 | `CSSProperties` | — |\n\n### SwiperNav\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| current | current 为受控值;未传时使用内部状态 | `number` | `0` |\n| total | 数据总条数 | `number` | `0` |\n| type | 类型 | `'dots'\\|'dots-bar'\\|'fraction'` | `'dots'` |\n| indicatorPosition | left、top-left、top、top-right、bottom-left、bottom、bottom-right、right | `'left'\\|'top-left'\\|'top'\\|'top-right'\\|'bottom-left'\\|'bottom'\\|'bottom-right'\\|'right'` | `'bottom'` |\n| minShowNum | minShowNum 配置 | `number` | `2` |\n| showControls | showControls 配置 | `boolean` | `false` |\n| hidePrev | hidePrev 配置 | `boolean` | `false` |\n| hideNext | hideNext 配置 | `boolean` | `false` |\n| className | 外层样式 | `string` | `''` |\n| style | 外层样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Swiper.onChange | 值发生变化时触发 | (current:number,source:SwiperChangeSource)=>void |\n| Swiper.onClick | 点击时触发 | (index:number,item:SwiperItem)=>void |\n| SwiperNav.onChange | 值发生变化时触发 | (event:{dir:'prev'\\|'next'})=>void |\n| SwiperNav.onSelect | 对应操作发生时触发 | (index:number)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Swiper.renderItem | 自定义每项内容;字符串/数字会包裹原生 text | (options:{item:SwiperItem;index:number})=>ReactNode |\n| Swiper.renderIndicator | 自定义指示器,优先于内置指示器 | (options:{current:number;total:number})=>ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| swipeTo | 调用实例方法 | (index:number)=>void |\n| swipeNext | 调用实例方法 | ()=>void |\n| swipePrev | 调用实例方法 | ()=>void |\n\n## 数据类型\n\n```tsx\nexport type SwiperItem = string | Record<string, unknown>;\n\nexport type SwiperChangeSource = 'autoplay' | 'touch' | 'nav';\n\nexport type SwiperIndicator = {\n type?: 'dots' | 'dots-bar' | 'fraction';\n minShowNum?: number;\n showControls?: boolean;\n};\n\nexport type ImgMode =\n | 'scaleToFill'\n | 'aspectFit'\n | 'aspectFill'\n | 'widthFix'\n | 'heightFix'\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top left'\n | 'top right'\n | 'bottom left'\n | 'bottom right';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-swiper-dot-active-color` | 当前组件 |\n| `--cso-ui-swiper-dot-color` | 当前组件 |\n\n## 源代码\n\n[Swiper 组件源码](./sources/swiper/Swiper.tsx.txt) · [SwiperNav 组件源码](./sources/swiper/SwiperNav.tsx.txt) · [示例源码](./sources/swiper/demo.tsx.txt) · [文档源码](./sources/swiper/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, Gap, Img, Swiper, Switch } from 'daisu-ui';\nimport redpanda from '../../../assets/demo-red-panda.jpg';\nimport capybara from '../../../assets/demo-capybara.jpg';\nimport panda from '../../../assets/demo-panda.jpg';\nimport meng from '../../../assets/demo-landscape.jpg';\nimport moon from '../../../assets/demo-moon.jpg';\nimport { swiperIndex } from 'daisu-ui/utils';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst images=[redpanda,capybara,panda,moon,meng];\nconst titled=images.slice(0,4).map((url,index)=>({url,title:['小熊猫!','卡!皮!巴!拉!','大熊猫!','诗画中国!'][index]}));\nexport function SwiperExample(){\n const [loop,setLoop]=useState(false),[controlled,setControlled]=useState(0);\n return <view className=\"demo-swiper-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"点状指示器\" noPadding><Swiper list={images} defaultCurrent={0}/></ExampleBlock><ExampleBlock title=\"点条状指示器\" noPadding><Swiper list={images} defaultCurrent={1} indicator={{type:'dots-bar'}}/></ExampleBlock><ExampleBlock title=\"数字指示器\" noPadding><Swiper list={images} defaultCurrent={2} indicator={{type:'fraction'}} indicatorPosition=\"bottom-right\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"手动切换\" noPadding><Swiper list={images} defaultCurrent={3} autoplay={false} loop={false} indicator={{showControls:true}}/></ExampleBlock><ExampleBlock title=\"指定valueKey和textKey\" noPadding><Swiper list={titled} valueKey=\"url\" textKey=\"title\" defaultCurrent={0}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"卡片样式\" noPadding><view className=\"demo-swiper-card\"><Swiper list={images} defaultCurrent={4} previousMargin={24} nextMargin={24} customItemClass=\"demo-swiper-card-item\" neighborHeight={168} customIndicatorClass=\"demo-swiper-card-indicator\"/></view></ExampleBlock><ExampleBlock title=\"同时展示2个滑块\" noPadding><view className=\"demo-swiper-card\"><Swiper list={images} defaultCurrent={0} displayMultipleItems={2} previousMargin={24} nextMargin={24} customItemClass=\"demo-swiper-card-item\" neighborHeight={168} customIndicatorClass=\"demo-swiper-card-indicator\"/></view></ExampleBlock><ExampleBlock title=\"自定义指示器\" noPadding><Swiper list={images} defaultCurrent={0} renderIndicator={({current,total})=><text className=\"demo-swiper-custom-indicator\">{current+1}/{total}</text>}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"属性控制切换\" noPadding><Swiper list={images} current={controlled} loop={loop} autoplay={false} onChange={value=>{ 'background only';setControlled(value); }}/><Gap/><CellGroup><Cell title=\"loop\"><Switch size={24} value={loop} style={{alignSelf:'flex-end'}} inactiveColor=\"var(--cso-ui-line)\" onChange={({value})=>{ 'background only';setLoop(Boolean(value)); }}/></Cell><Cell title=\"current\" value={String(controlled)}/></CellGroup><view className=\"demo-swiper-actions\"><Button label=\"prev\" onTap={()=>{ 'background only';setControlled(value=>swiperIndex(value-1,images.length,loop)); }}/><Button label=\"next\" tone=\"success\" onTap={()=>{ 'background only';setControlled(value=>swiperIndex(value+1,images.length,loop)); }}/></view></ExampleBlock><ExampleBlock title=\"插槽用法\" noPadding><Swiper list={images} defaultCurrent={1} indicator={{type:'dots-bar'}} renderItem={({item})=><Img src={String(item)} mode=\"aspectFill\" width=\"100%\" height=\"100%\" showLoading={false} showError={false}/>}/></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"list","type":"readonly SwiperItem[]","optional":false,"description":"图片地址或对象列表;空列表不创建分页内核","defaultValue":"必填"},{"name":"current","type":"number","optional":true,"description":"current 为受控值;未传时使用内部状态","defaultValue":"0"},{"name":"defaultCurrent","type":"number","optional":true,"description":"current 为受控值;未传时使用内部状态","defaultValue":"0"},{"name":"autoplay","type":"boolean","optional":true,"description":"自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时","defaultValue":"true","values":[false,true]},{"name":"interval","type":"number","optional":true,"description":"自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时","defaultValue":"5000"},{"name":"duration","type":"number","optional":true,"description":"原生动画时长 ms;非循环到末项后停止自动播放","defaultValue":"300"},{"name":"loop","type":"boolean","optional":true,"description":"原生动画时长 ms;非循环到末项后停止自动播放","defaultValue":"true","values":[false,true]},{"name":"height","type":"number|string","optional":true,"description":"数字为 px;字符串按 Img 尺寸规则处理","defaultValue":"192"},{"name":"displayMultipleItems","type":"number","optional":true,"description":"同时显示数量,归一为 1 到列表长度间的整数","defaultValue":"1"},{"name":"previousMargin","type":"number","optional":true,"description":"两侧留白,单位 px;不接受 CSS 字符串或 rpx","defaultValue":"0"},{"name":"nextMargin","type":"number","optional":true,"description":"两侧留白,单位 px;不接受 CSS 字符串或 rpx","defaultValue":"0"},{"name":"neighborHeight","type":"number","optional":true,"description":"邻项高度 px;启用原生进度卡片动画,限制在 0 到当前轮播高度间,不再叠加图片 height 过渡"},{"name":"indicator","type":"boolean|SwiperIndicator","optional":true,"description":"false 隐藏;对象包含 type、minShowNum、showControls","defaultValue":"true"},{"name":"indicatorPosition","type":"'left'|'top-left'|'top'|'top-right'|'bottom-left'|'bottom'|'bottom-right'|'right'","optional":true,"description":"left、top-left、top、top-right、bottom-left、bottom、bottom-right、right","defaultValue":"'bottom'","values":["bottom","left","right","top","top-left","top-right","bottom-left","bottom-right"]},{"name":"valueKey","type":"string","optional":true,"description":"对象中的图片地址和右上角标题字段","defaultValue":"'value'"},{"name":"textKey","type":"string","optional":true,"description":"对象中的图片地址和右上角标题字段","defaultValue":"'text'"},{"name":"imageMode","type":"ImgMode","optional":true,"description":"使用公共 Img 支持的模式","defaultValue":"'aspectFill'","values":["bottom","left","right","top","center","scaleToFill","aspectFit","aspectFill","widthFix","heightFix","top left","top right","bottom left","bottom right"]},{"name":"customIndicatorClass","type":"string","optional":true,"description":"指示器与所有项目的样式类","defaultValue":"''"},{"name":"customItemClass","type":"string","optional":true,"description":"指示器与所有项目的样式类","defaultValue":"''"},{"name":"customPrevClass","type":"string","optional":true,"description":"前一项、后一项的样式类,可实现卡片效果","defaultValue":"''"},{"name":"customNextClass","type":"string","optional":true,"description":"前一项、后一项的样式类,可实现卡片效果","defaultValue":"''"},{"name":"customTextClass","type":"string","optional":true,"description":"标题样式","defaultValue":"''"},{"name":"customTextStyle","type":"CSSProperties","optional":true,"description":"标题样式"},{"name":"className","type":"string","optional":true,"description":"外层样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"外层样式"}],"events":[{"name":"onChange","type":"(current:number,source:SwiperChangeSource)=>void","optional":true,"description":""},{"name":"onClick","type":"(index:number,item:SwiperItem)=>void","optional":true,"description":""}],"slots":[{"name":"renderItem","type":"(options:{item:SwiperItem;index:number})=>ReactNode","optional":true,"description":""},{"name":"renderIndicator","type":"(options:{current:number;total:number})=>ReactNode","optional":true,"description":""}],"methods":[{"name":"swipeTo","description":"调用实例方法","type":"(index:number)=>void"},{"name":"swipeNext","description":"调用实例方法","type":"()=>void"},{"name":"swipePrev","description":"调用实例方法","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-swiper-dot-active-color","defaultValue":"#fff","description":""},{"name":"--cso-ui-swiper-dot-color","defaultValue":"#c9cbd4","description":""}],"demos":[{"name":"basic","aliases":["demo-1","图片轮播"],"title":"图片轮播","section":"组件类型","description":"通过 `list` 设置图片地址列表,通过 `height` 设置轮播区域高度。","language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","关闭自动播放"],"title":"关闭自动播放","section":"交互用法","description":"设置 `autoplay={false}` 关闭自动播放,通过 `onChange` 获取切换结果。","language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义轮播项"],"title":"自定义轮播项","section":"内容形态","description":"通过 `renderItem` 自定义每一项的内容。","language":"tsx","code":"<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"swiperIndex","id":"swiper-index","label":"swiperIndex","category":"公共 API","categoryId":"api","kind":"utility","description":"swiperIndex 公开 API","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/swiperModel.ts","doc":"","props":[{"name":"toString","type":"string","optional":false,"description":"Returns a string representation of an object."},{"name":"toFixed","type":"string","optional":false,"description":"Returns a string representing a number in fixed-point notation."},{"name":"toExponential","type":"string","optional":false,"description":"Returns a string containing a number represented in exponential notation."},{"name":"toPrecision","type":"string","optional":false,"description":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."},{"name":"valueOf","type":"number","optional":false,"description":"Returns the primitive value of the specified object."},{"name":"toLocaleString","type":"string","optional":false,"description":"Converts a number to a string by using the current or specified locale."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"SwiperNav","id":"swiper","label":"Swiper 轮播图","category":"数据展示","categoryId":"display","kind":"component","description":"轮播图用于在固定区域切换图片或自定义内容,支持自动播放、指示器和滑动控制。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SwiperNav.tsx","docPath":"docs/ui/components/swiper.md","doc":"# Swiper 轮播图\n\n轮播图用于在固定区域切换图片或自定义内容,支持自动播放、指示器和滑动控制。\n\n```tsx\nimport { Swiper, SwiperNav } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 图片轮播\n\n通过 `list` 设置图片地址列表,通过 `height` 设置轮播区域高度。\n\n```tsx\n<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n```\n\n## 交互用法\n\n### 关闭自动播放\n\n设置 `autoplay={false}` 关闭自动播放,通过 `onChange` 获取切换结果。\n\n```tsx\n<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n```\n\n## 内容形态\n\n### 自定义轮播项\n\n通过 `renderItem` 自定义每一项的内容。\n\n```tsx\n<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n```\n\n## Attributes 属性\n\n### Swiper\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| list | 图片地址或对象列表;空列表不创建分页内核 | `readonly SwiperItem[]` | 必填 |\n| current | current 为受控值;未传时使用内部状态 | `number` | — |\n| defaultCurrent | current 为受控值;未传时使用内部状态 | `number` | `0` |\n| autoplay | 自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时 | `boolean` | `true` |\n| interval | 自动播放与间隔,单位 ms;拖动或动画期间暂停计时,结束后重新计时 | `number` | `5000` |\n| duration | 原生动画时长 ms;非循环到末项后停止自动播放 | `number` | `300` |\n| loop | 原生动画时长 ms;非循环到末项后停止自动播放 | `boolean` | `true` |\n| height | 数字为 px;字符串按 Img 尺寸规则处理 | `number\\|string` | `192` |\n| displayMultipleItems | 同时显示数量,归一为 1 到列表长度间的整数 | `number` | `1` |\n| previousMargin | 两侧留白,单位 px;不接受 CSS 字符串或 rpx | `number` | `0` |\n| nextMargin | 两侧留白,单位 px;不接受 CSS 字符串或 rpx | `number` | `0` |\n| neighborHeight | 邻项高度 px;启用原生进度卡片动画,限制在 0 到当前轮播高度间,不再叠加图片 height 过渡 | `number` | — |\n| indicator | false 隐藏;对象包含 type、minShowNum、showControls | `boolean\\|SwiperIndicator` | `true` |\n| indicatorPosition | left、top-left、top、top-right、bottom-left、bottom、bottom-right、right | `'left'\\|'top-left'\\|'top'\\|'top-right'\\|'bottom-left'\\|'bottom'\\|'bottom-right'\\|'right'` | `'bottom'` |\n| valueKey | 对象中的图片地址和右上角标题字段 | `string` | `'value'` |\n| textKey | 对象中的图片地址和右上角标题字段 | `string` | `'text'` |\n| imageMode | 使用公共 Img 支持的模式 | `ImgMode` | `'aspectFill'` |\n| customIndicatorClass | 指示器与所有项目的样式类 | `string` | `''` |\n| customItemClass | 指示器与所有项目的样式类 | `string` | `''` |\n| customPrevClass | 前一项、后一项的样式类,可实现卡片效果 | `string` | `''` |\n| customNextClass | 前一项、后一项的样式类,可实现卡片效果 | `string` | `''` |\n| customTextClass | 标题样式 | `string` | `''` |\n| customTextStyle | 标题样式 | `CSSProperties` | — |\n| className | 外层样式 | `string` | `''` |\n| style | 外层样式 | `CSSProperties` | — |\n\n### SwiperNav\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| current | current 为受控值;未传时使用内部状态 | `number` | `0` |\n| total | 数据总条数 | `number` | `0` |\n| type | 类型 | `'dots'\\|'dots-bar'\\|'fraction'` | `'dots'` |\n| indicatorPosition | left、top-left、top、top-right、bottom-left、bottom、bottom-right、right | `'left'\\|'top-left'\\|'top'\\|'top-right'\\|'bottom-left'\\|'bottom'\\|'bottom-right'\\|'right'` | `'bottom'` |\n| minShowNum | minShowNum 配置 | `number` | `2` |\n| showControls | showControls 配置 | `boolean` | `false` |\n| hidePrev | hidePrev 配置 | `boolean` | `false` |\n| hideNext | hideNext 配置 | `boolean` | `false` |\n| className | 外层样式 | `string` | `''` |\n| style | 外层样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| Swiper.onChange | 值发生变化时触发 | (current:number,source:SwiperChangeSource)=>void |\n| Swiper.onClick | 点击时触发 | (index:number,item:SwiperItem)=>void |\n| SwiperNav.onChange | 值发生变化时触发 | (event:{dir:'prev'\\|'next'})=>void |\n| SwiperNav.onSelect | 对应操作发生时触发 | (index:number)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| Swiper.renderItem | 自定义每项内容;字符串/数字会包裹原生 text | (options:{item:SwiperItem;index:number})=>ReactNode |\n| Swiper.renderIndicator | 自定义指示器,优先于内置指示器 | (options:{current:number;total:number})=>ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| swipeTo | 调用实例方法 | (index:number)=>void |\n| swipeNext | 调用实例方法 | ()=>void |\n| swipePrev | 调用实例方法 | ()=>void |\n\n## 数据类型\n\n```tsx\nexport type SwiperItem = string | Record<string, unknown>;\n\nexport type SwiperChangeSource = 'autoplay' | 'touch' | 'nav';\n\nexport type SwiperIndicator = {\n type?: 'dots' | 'dots-bar' | 'fraction';\n minShowNum?: number;\n showControls?: boolean;\n};\n\nexport type ImgMode =\n | 'scaleToFill'\n | 'aspectFit'\n | 'aspectFill'\n | 'widthFix'\n | 'heightFix'\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top left'\n | 'top right'\n | 'bottom left'\n | 'bottom right';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-swiper-dot-active-color` | 当前组件 |\n| `--cso-ui-swiper-dot-color` | 当前组件 |\n\n## 源代码\n\n[Swiper 组件源码](./sources/swiper/Swiper.tsx.txt) · [SwiperNav 组件源码](./sources/swiper/SwiperNav.tsx.txt) · [示例源码](./sources/swiper/demo.tsx.txt) · [文档源码](./sources/swiper/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, Gap, Img, Swiper, Switch } from 'daisu-ui';\nimport redpanda from '../../../assets/demo-red-panda.jpg';\nimport capybara from '../../../assets/demo-capybara.jpg';\nimport panda from '../../../assets/demo-panda.jpg';\nimport meng from '../../../assets/demo-landscape.jpg';\nimport moon from '../../../assets/demo-moon.jpg';\nimport { swiperIndex } from 'daisu-ui/utils';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst images=[redpanda,capybara,panda,moon,meng];\nconst titled=images.slice(0,4).map((url,index)=>({url,title:['小熊猫!','卡!皮!巴!拉!','大熊猫!','诗画中国!'][index]}));\nexport function SwiperExample(){\n const [loop,setLoop]=useState(false),[controlled,setControlled]=useState(0);\n return <view className=\"demo-swiper-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"点状指示器\" noPadding><Swiper list={images} defaultCurrent={0}/></ExampleBlock><ExampleBlock title=\"点条状指示器\" noPadding><Swiper list={images} defaultCurrent={1} indicator={{type:'dots-bar'}}/></ExampleBlock><ExampleBlock title=\"数字指示器\" noPadding><Swiper list={images} defaultCurrent={2} indicator={{type:'fraction'}} indicatorPosition=\"bottom-right\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"手动切换\" noPadding><Swiper list={images} defaultCurrent={3} autoplay={false} loop={false} indicator={{showControls:true}}/></ExampleBlock><ExampleBlock title=\"指定valueKey和textKey\" noPadding><Swiper list={titled} valueKey=\"url\" textKey=\"title\" defaultCurrent={0}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"卡片样式\" noPadding><view className=\"demo-swiper-card\"><Swiper list={images} defaultCurrent={4} previousMargin={24} nextMargin={24} customItemClass=\"demo-swiper-card-item\" neighborHeight={168} customIndicatorClass=\"demo-swiper-card-indicator\"/></view></ExampleBlock><ExampleBlock title=\"同时展示2个滑块\" noPadding><view className=\"demo-swiper-card\"><Swiper list={images} defaultCurrent={0} displayMultipleItems={2} previousMargin={24} nextMargin={24} customItemClass=\"demo-swiper-card-item\" neighborHeight={168} customIndicatorClass=\"demo-swiper-card-indicator\"/></view></ExampleBlock><ExampleBlock title=\"自定义指示器\" noPadding><Swiper list={images} defaultCurrent={0} renderIndicator={({current,total})=><text className=\"demo-swiper-custom-indicator\">{current+1}/{total}</text>}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"属性控制切换\" noPadding><Swiper list={images} current={controlled} loop={loop} autoplay={false} onChange={value=>{ 'background only';setControlled(value); }}/><Gap/><CellGroup><Cell title=\"loop\"><Switch size={24} value={loop} style={{alignSelf:'flex-end'}} inactiveColor=\"var(--cso-ui-line)\" onChange={({value})=>{ 'background only';setLoop(Boolean(value)); }}/></Cell><Cell title=\"current\" value={String(controlled)}/></CellGroup><view className=\"demo-swiper-actions\"><Button label=\"prev\" onTap={()=>{ 'background only';setControlled(value=>swiperIndex(value-1,images.length,loop)); }}/><Button label=\"next\" tone=\"success\" onTap={()=>{ 'background only';setControlled(value=>swiperIndex(value+1,images.length,loop)); }}/></view></ExampleBlock><ExampleBlock title=\"插槽用法\" noPadding><Swiper list={images} defaultCurrent={1} indicator={{type:'dots-bar'}} renderItem={({item})=><Img src={String(item)} mode=\"aspectFill\" width=\"100%\" height=\"100%\" showLoading={false} showError={false}/>}/></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"current","type":"number","optional":true,"description":"current 为受控值;未传时使用内部状态","defaultValue":"0"},{"name":"total","type":"number","optional":true,"description":"数据总条数","defaultValue":"0"},{"name":"type","type":"'dots'|'dots-bar'|'fraction'","optional":true,"description":"类型","defaultValue":"'dots'","values":["dots","dots-bar","fraction"]},{"name":"indicatorPosition","type":"'left'|'top-left'|'top'|'top-right'|'bottom-left'|'bottom'|'bottom-right'|'right'","optional":true,"description":"left、top-left、top、top-right、bottom-left、bottom、bottom-right、right","defaultValue":"'bottom'","values":["bottom","left","right","top","top-left","top-right","bottom-left","bottom-right"]},{"name":"minShowNum","type":"number","optional":true,"description":"minShowNum 配置","defaultValue":"2"},{"name":"showControls","type":"boolean","optional":true,"description":"showControls 配置","defaultValue":"false","values":[false,true]},{"name":"hidePrev","type":"boolean","optional":true,"description":"hidePrev 配置","defaultValue":"false","values":[false,true]},{"name":"hideNext","type":"boolean","optional":true,"description":"hideNext 配置","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"外层样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"外层样式"}],"events":[{"name":"onChange","type":"(event:{dir:'prev'|'next'})=>void","optional":true,"description":""},{"name":"onSelect","type":"(index:number)=>void","optional":true,"description":""}],"slots":[],"methods":[{"name":"swipeTo","description":"调用实例方法","type":"(index:number)=>void"},{"name":"swipeNext","description":"调用实例方法","type":"()=>void"},{"name":"swipePrev","description":"调用实例方法","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-swiper-dot-active-color","defaultValue":"#fff","description":""},{"name":"--cso-ui-swiper-dot-color","defaultValue":"#c9cbd4","description":""}],"demos":[{"name":"basic","aliases":["demo-1","图片轮播"],"title":"图片轮播","section":"组件类型","description":"通过 `list` 设置图片地址列表,通过 `height` 设置轮播区域高度。","language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n height={192}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","关闭自动播放"],"title":"关闭自动播放","section":"交互用法","description":"设置 `autoplay={false}` 关闭自动播放,通过 `onChange` 获取切换结果。","language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={['https://example.com/a.jpg', 'https://example.com/b.jpg']}\n autoplay={false}\n onChange={(event) => {\n 'background only';\n console.log(event);\n }}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义轮播项"],"title":"自定义轮播项","section":"内容形态","description":"通过 `renderItem` 自定义每一项的内容。","language":"tsx","code":"<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n","blocks":[{"language":"tsx","code":"<Swiper\n list={[\n { value: 'one', text: '内容一' },\n { value: 'two', text: '内容二' },\n ]}\n renderItem={({ item }) => <text>{String(item)}</text>}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Switch","id":"switch","label":"Switch 开关","category":"录入","categoryId":"form","kind":"component","description":"开关用于切换两个互斥状态,支持加载、禁用、自定义值和切换前校验。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Switch.tsx","docPath":"docs/ui/components/switch.md","doc":"# Switch 开关\n\n开关用于切换两个互斥状态,支持加载、禁用、自定义值和切换前校验。\n\n```tsx\nimport { Switch } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 受控开关\n\n通过 `value` 和 `onChange` 控制开关,事件中的 `value` 为切换后的值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(true);\n\n<Switch\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(Boolean(event.value));\n }}\n/>\n```\n\n## 组件状态\n\n### 加载与禁用\n\n设置 `loading` 展示加载状态,设置 `disabled` 禁止切换。\n\n```tsx\n<Switch loading />\n<Switch value disabled />\n```\n\n## 交互用法\n\n### 异步校验\n\n通过 `beforeChange` 在切换前执行异步校验,返回 `true` 后才更新状态。\n\n```tsx\n<Switch\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| value | 当前值;传入后由调用方更新 | `SwitchValue` | — |\n| defaultValue | 非受控模式的初始值 | `SwitchValue` | `false` |\n| activeValue | 开启状态对应的值 | `SwitchValue` | `true` |\n| inactiveValue | 关闭状态对应的值 | `SwitchValue` | `false` |\n| activeColor | 选中状态颜色 | `string` | — |\n| inactiveColor | 未选中状态颜色 | `string` | — |\n| size | 尺寸 | `number \\| string` | `26` |\n| shape | 形状 | `'round' \\| 'square'` | `'round'` |\n| disabled | 是否禁用 | `boolean` | — |\n| loading | 加载状态或自定义加载内容 | `boolean` | `false` |\n| loadingProps | 加载指示器属性 | `Partial<LoadingProps>` | — |\n| activeText | 开启状态文字 | `string` | `''` |\n| inactiveText | 关闭状态文案 | `string` | `''` |\n| activeIcon | 激活状态图标 | `string \\| ReactNode` | — |\n| inactiveIcon | 未激活状态图标 | `string \\| ReactNode` | — |\n| activeActionIcon | activeActionIcon 配置 | `string \\| ReactNode` | — |\n| inactiveActionIcon | inactiveActionIcon 配置 | `string \\| ReactNode` | — |\n| beforeChange | 变化前校验;返回 false 或拒绝 Promise 可阻止变化 | `(value: SwitchValue) => boolean \\| Promise<boolean>` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| accessibilityLabel | 读屏工具使用的操作说明 | `string` | `'开关'` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { value: SwitchValue }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| activeIcon | 激活状态图标 | string \\| ReactNode |\n| inactiveIcon | 未激活状态图标 | string \\| ReactNode |\n| activeActionIcon | 自定义区域内容 | string \\| ReactNode |\n| inactiveActionIcon | 自定义区域内容 | string \\| ReactNode |\n\n## 数据类型\n\n```tsx\nexport type SwitchValue = boolean | string | number;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-line-strong` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n\n## 源代码\n\n[Switch 组件源码](./sources/switch/Switch.tsx.txt) · [示例源码](./sources/switch/demo.tsx.txt) · [文档源码](./sources/switch/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, Dialog, Switch, useDialog } from 'daisu-ui';\nimport type { SwitchValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function SwitchExample() {\n const [work, setWork] = useState<SwitchValue>('上班');\n const dialog = useDialog();\n const guard = () => dialog.confirm('是否切换开关').then(() => true).catch(() => false);\n return <view>\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><view className=\"demo-switch-row\"><Switch defaultValue /></view></ExampleBlock>\n <ExampleBlock title=\"修改值 active-value 、 inactive-value\"><text className=\"demo-switch-value\">{String(work)}</text><view className=\"demo-switch-row\"><Switch value={work} activeValue=\"上班\" inactiveValue=\"下班\" onChange={({ value }) => setWork(value)} /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"加载状态\"><view className=\"demo-switch-row\"><Switch defaultValue loading activeText=\"上班\" inactiveText=\"下班\" /><Switch loading activeText=\"上班\" inactiveText=\"下班\" /></view></ExampleBlock>\n <ExampleBlock title=\"禁用状态\"><view className=\"demo-switch-row\"><Switch defaultValue disabled /><Switch disabled /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义颜色 active-color 、 inactive-color\"><view className=\"demo-switch-row\"><Switch defaultValue activeColor=\"#13ce66\" inactiveColor=\"#f00\" /></view></ExampleBlock>\n <ExampleBlock title=\"文字描述\"><view className=\"demo-switch-row\"><Switch defaultValue activeText=\"上班\" inactiveText=\"下班\" /></view></ExampleBlock>\n <ExampleBlock title=\"自定义显示图标\"><view className=\"demo-switch-row\"><Switch activeIcon=\"check\" inactiveIcon=\"close\" /></view></ExampleBlock>\n <ExampleBlock title=\"自定义动作图标\"><view className=\"demo-switch-row\"><Switch activeActionIcon=\"check\" inactiveActionIcon=\"close\" /></view></ExampleBlock>\n <ExampleBlock title=\"形状\"><view className=\"demo-switch-row\"><Switch defaultValue activeText=\"全圆\" inactiveText=\"全圆\" /><Switch shape=\"square\" activeText=\"直角\" inactiveText=\"直角\" /></view></ExampleBlock>\n <ExampleBlock title=\"自定义大小\"><view className=\"demo-switch-row demo-switch-row-bottom\">{[24, 32, 40, 48].map(size => <Switch key={size} size={size} defaultValue />)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"搭配表单使用\" noPadding><Cell title=\"搭配表单使用\" center><Switch size={20} /></Cell></ExampleBlock>\n <ExampleBlock title=\"before-change 修改前钩子函数\"><view className=\"demo-switch-row\"><Switch beforeChange={guard} /></view></ExampleBlock>\n </DemoGroup>\n <Dialog {...dialog.props} rootPortal className=\"ui-demo-page\" />\n </view>;\n}\n","props":[{"name":"value","type":"SwitchValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"SwitchValue","optional":true,"description":"非受控模式的初始值","defaultValue":"false"},{"name":"activeValue","type":"SwitchValue","optional":true,"description":"开启状态对应的值","defaultValue":"true"},{"name":"inactiveValue","type":"SwitchValue","optional":true,"description":"关闭状态对应的值","defaultValue":"false"},{"name":"activeColor","type":"string","optional":true,"description":"选中状态颜色"},{"name":"inactiveColor","type":"string","optional":true,"description":"未选中状态颜色"},{"name":"size","type":"number | string","optional":true,"description":"尺寸","defaultValue":"26"},{"name":"shape","type":"'round' | 'square'","optional":true,"description":"形状","defaultValue":"'round'","values":["square","round"]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"loading","type":"boolean","optional":true,"description":"加载状态或自定义加载内容","defaultValue":"false","values":[false,true]},{"name":"loadingProps","type":"Partial<LoadingProps>","optional":true,"description":"加载指示器属性"},{"name":"activeText","type":"string","optional":true,"description":"开启状态文字","defaultValue":"''"},{"name":"inactiveText","type":"string","optional":true,"description":"关闭状态文案","defaultValue":"''"},{"name":"activeIcon","type":"string | ReactNode","optional":true,"description":"激活状态图标"},{"name":"inactiveIcon","type":"string | ReactNode","optional":true,"description":"未激活状态图标"},{"name":"activeActionIcon","type":"string | ReactNode","optional":true,"description":"自定义区域内容"},{"name":"inactiveActionIcon","type":"string | ReactNode","optional":true,"description":"自定义区域内容"},{"name":"beforeChange","type":"(value: SwitchValue) => boolean | Promise<boolean>","optional":true,"description":"变化前校验;返回 false 或拒绝 Promise 可阻止变化"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"accessibilityLabel","type":"string","optional":true,"description":"读屏工具使用的操作说明","defaultValue":"'开关'"}],"events":[{"name":"onChange","type":"(event: { value: SwitchValue }) => void","optional":true,"description":"值发生变化时触发"}],"slots":[{"name":"activeIcon","type":"string | ReactNode","optional":true,"description":"激活状态图标"},{"name":"inactiveIcon","type":"string | ReactNode","optional":true,"description":"未激活状态图标"},{"name":"activeActionIcon","type":"string | ReactNode","optional":true,"description":"自定义区域内容"},{"name":"inactiveActionIcon","type":"string | ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[],"cssVars":[{"name":"--cso-ui-line-strong","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"}],"demos":[{"name":"basic","aliases":["demo-1","受控开关"],"title":"受控开关","section":"组件类型","description":"通过 `value` 和 `onChange` 控制开关,事件中的 `value` 为切换后的值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(true);\n\n<Switch\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(Boolean(event.value));\n }}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState(true);\n\n<Switch\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(Boolean(event.value));\n }}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","加载与禁用"],"title":"加载与禁用","section":"组件状态","description":"设置 `loading` 展示加载状态,设置 `disabled` 禁止切换。","language":"tsx","code":"<Switch loading />\n<Switch value disabled />\n","blocks":[{"language":"tsx","code":"<Switch loading />\n<Switch value disabled />\n"}]},{"name":"demo-3","aliases":["demo-3","异步校验"],"title":"异步校验","section":"交互用法","description":"通过 `beforeChange` 在切换前执行异步校验,返回 `true` 后才更新状态。","language":"tsx","code":"<Switch\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Switch\n beforeChange={async (value) => {\n 'background only';\n console.log(value);\n return true;\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"SyncedInput","id":"synced-input","label":"SyncedInput","category":"公共 API","categoryId":"api","kind":"component","description":"SyncedInput 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SyncedInput.tsx","doc":"","props":[{"name":"className","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"placeholder","type":"string","optional":true,"description":""},{"name":"maxlength","type":"number","optional":true,"description":""},{"name":"softInputMode","type":"'unspecified' | 'nothing' | 'pan' | 'resize'","optional":true,"description":"","defaultValue":"'nothing'","values":["resize","unspecified","nothing","pan"]},{"name":"avoidKeyboard","type":"boolean","optional":true,"description":"","defaultValue":"false","values":[false,true]}],"events":[{"name":"onInput","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"SyncedTextarea","id":"synced-textarea","label":"SyncedTextarea","category":"公共 API","categoryId":"api","kind":"component","description":"SyncedTextarea 公开 API","importFrom":"daisu-ui","source":"packages/daisu-ui/src/SyncedTextarea.tsx","doc":"","props":[{"name":"className","type":"string","optional":true,"description":""},{"name":"value","type":"string","optional":false,"description":""},{"name":"placeholder","type":"string","optional":true,"description":""},{"name":"maxlength","type":"number","optional":true,"description":""},{"name":"maxlines","type":"number","optional":true,"description":""}],"events":[{"name":"onInput","type":"(value: string) => void","optional":false,"description":""},{"name":"onBlur","type":"() => void","optional":true,"description":""}],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"Tabbar","id":"tabbar","label":"Tabbar 标签栏","category":"导航","categoryId":"navigation","kind":"component","description":"标签栏用于切换应用中的主要页面,支持图标、徽标、异步切换校验和底部安全区。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Tabbar.tsx","docPath":"docs/ui/components/tabbar.md","doc":"# Tabbar 标签栏\n\n标签栏用于切换应用中的主要页面,支持图标、徽标、异步切换校验和底部安全区。\n\n```tsx\nimport { Tabbar } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础标签栏\n\n通过 `items` 配置标签项,`value` 指定当前项,`onChange` 返回新的选中值。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<Tabbar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { name: 0, title: '首页', icon: 'home' },\n { name: 1, title: '我的', icon: 'user' },\n ]}\n/>\n```\n\n## 布局能力\n\n### 固定底部\n\n设置 `fixed` 固定在底部,配合 `placeholder` 和 `safeAreaInsetBottom` 预留内容与安全区空间。\n\n```tsx\n<Tabbar\n fixed\n placeholder\n safeAreaInsetBottom\n items={[\n { name: 'home', title: '首页', icon: 'home' },\n { name: 'me', title: '我的', icon: 'user' },\n ]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 子项数据,等宽排列 | `readonly TabbarItem[]` | 必填 |\n| value | 对应 v-model,受控或非受控;严格匹配名称,否则使用索引 | `TabbarValue` | — |\n| defaultValue | 对应 v-model,受控或非受控;严格匹配名称,否则使用索引 | `TabbarValue` | `0` |\n| beforeChange | false、异常或拒绝均阻止切换;旧确认结果不会覆盖新点击 | `TabbarBeforeChange` | — |\n| fixed | 固定底部,按需在原位置保留等高占位 | `boolean` | `false` |\n| placeholder | 固定底部,按需在原位置保留等高占位 | `boolean` | `false` |\n| bordered | 默认形状的顶部细边框;round 忽略此项 | `boolean` | `false` |\n| safeAreaInsetBottom | 启用宿主传入的底部安全区 | `boolean` | `false` |\n| bottomSafeAreaHeight | 宿主安全距离,px;负数、非有限值按0处理 | `number` | `0` |\n| shape | round 水平外边距16px、圆角、阴影 | `'default' \\| 'round'` | `'default'` |\n| activeColor | 文字与内置图标颜色;SVG 图标请传实际颜色值,如 #1c64fd | `string` | — |\n| inactiveColor | 文字与内置图标颜色;SVG 图标请传实际颜色值,如 #1c64fd | `string` | — |\n| zIndex | 固定定位层级 | `number` | `10` |\n| className | 根节点类名 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 成功切换后触发;重复点击当前项不触发 | (event: { value: TabbarValue }) => void |\n\n## 数据类型\n\n```tsx\nexport type TabbarItem = {\n name?: TabbarValue;\n title?: string;\n icon?: string;\n value?: string | number;\n isDot?: boolean;\n max?: number;\n badgeProps?: Omit<BadgeProps, 'children'>;\n renderIcon?: (state: { active: boolean }) => ReactNode;\n children?: ReactNode;\n className?: string;\n};\n\nexport type TabbarValue = string | number;\n\nexport type TabbarBeforeChange = (\n value: TabbarValue,\n) => boolean | Promise<boolean>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Tabbar 组件源码](./sources/tabbar/Tabbar.tsx.txt) · [示例源码](./sources/tabbar/demo.tsx.txt) · [文档源码](./sources/tabbar/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Button, Icon, Loading, RootPortal, Tabbar } from 'daisu-ui';\nimport type { TabbarItem, TabbarValue } from 'daisu-ui';\nimport panda from '../../../assets/demo-panda.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst basic: readonly TabbarItem[] = [{ title: '首页', icon: 'home' }, { title: '分类', icon: 'store' }, { title: '我的', icon: 'user' }];\nconst named: readonly TabbarItem[] = [{ name: 'home', title: '首页', icon: 'home' }, { name: 'cart', title: '分类', icon: 'store' }, { name: 'setting', title: '设置', icon: 'settings' }, { name: 'user', title: '我的', icon: 'user' }];\nconst badges: readonly TabbarItem[] = [{ title: '点状', icon: 'home', isDot: true, value: 2 }, { title: '分类', icon: 'store', value: 2 }, { title: '我的', icon: 'user', value: 30 }, { title: '最大值', icon: 'user', value: 200 }];\nconst round: readonly TabbarItem[] = [{ title: '首页', icon: 'home', isDot: true }, { title: '分类', icon: 'store', value: 2 }, { title: '相册', icon: 'image', value: 30 }, { title: '我的', icon: 'user', value: 200 }];\nconst custom: readonly TabbarItem[] = [{ title: '首页', icon: 'home', value: 2 }, { title: '分类', value: 2, renderIcon: () => <image className=\"demo-tabbar-avatar\" src={panda} mode=\"aspectFill\" /> }, { title: '我的', icon: 'user', value: 3 }];\nconst five: readonly TabbarItem[] = [{ title: '首页', icon: 'home' }, { title: '分类', icon: 'store' }, { title: '我的', icon: 'user' }, { title: '相册', icon: 'image' }, { title: '客服', icon: 'message' }];\nconst fixed: readonly TabbarItem[] = five.map((item, index) => ({ ...item, isDot: index === 0, value: index === 3 ? 200 : index === 4 ? 10 : undefined }));\nconst colors: readonly TabbarItem[] = [...badges.slice(0, 3), { title: '最大值', icon: 'image', value: 200 }, { title: '客服', icon: 'message', value: 10 }];\n\nexport function TabbarExample({ theme }: { theme: 'light' | 'dark' }) {\n const [values, setValues] = useState<TabbarValue[]>([1, 'home', 2, 2, 1, 1, 1, 1, 1, 1]);\n const [notice, setNotice] = useState('');\n const [loading, setLoading] = useState(false);\n const [dialog, setDialog] = useState(false);\n const toastTimer = useRef<ReturnType<typeof setTimeout>>();\n const pending = useRef(new Map<ReturnType<typeof setTimeout>, (allowed: boolean) => void>());\n useEffect(() => () => { clearTimeout(toastTimer.current); for (const [timer, resolve] of pending.current) { clearTimeout(timer); resolve(false); } pending.current.clear(); }, []);\n const change = (index: number, value: TabbarValue) => { 'background only'; setValues(old => old.map((item, i) => i === index ? value : item)); };\n const show = (message: string) => { 'background only'; clearTimeout(toastTimer.current); setNotice(message); toastTimer.current = setTimeout(() => setNotice(''), 1500); };\n const activeColor = theme === 'dark' ? '#5b90ff' : '#1c64fd';\n const danger = theme === 'dark' ? '#ff7875' : '#fa4350';\n const placeholder = theme === 'dark' ? '#696b70' : '#bfbfbf';\n const raised: readonly TabbarItem[] = [fixed[0]!, fixed[1]!, { children: <view className=\"demo-tabbar-raised\"><Icon name=\"plus\" size={32} color={activeColor} /></view> }, fixed[3]!, fixed[4]!];\n const render = (index: number, items: readonly TabbarItem[], props: Partial<Parameters<typeof Tabbar>[0]> = {}) => <Tabbar items={items} value={values[index]} onChange={event => { 'background only'; change(index, event.value); }} activeColor={activeColor} {...props} />;\n return <view className=\"demo-tabbar-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基础用法\" noPadding>{render(0, basic, { bordered: true })}</ExampleBlock>\n <ExampleBlock title=\"通过名称匹配\" noPadding>{render(1, named, { bordered: true })}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"徽标提示\" noPadding>{render(2, badges)}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"悬浮标签栏\" noPadding>{render(3, round, { shape: 'round' })}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义图标\" noPadding>{render(4, custom)}</ExampleBlock>\n <ExampleBlock title=\"自定义颜色\" noPadding>{render(5, colors, { activeColor: danger, inactiveColor: placeholder })}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"监听切换事件\" noPadding>{render(6, five, { activeColor: danger, inactiveColor: placeholder, onChange: event => { 'background only'; change(6, event.value); show(`选中标签:${event.value}`); } })}</ExampleBlock>\n <ExampleBlock title=\"默认插槽\" noPadding>{render(7, raised, { beforeChange: name => { 'background only'; if (name === 2) { setDialog(true); return false; } return true; } })}</ExampleBlock>\n <ExampleBlock title=\"异步确认\" noPadding>{render(8, fixed, { bordered: true, beforeChange: () => { 'background only'; setLoading(true); return new Promise<boolean>(resolve => { const timer = setTimeout(() => { pending.current.delete(timer); if (pending.current.size === 0) setLoading(false); resolve(true); }, 1000); pending.current.set(timer, resolve); }); } })}</ExampleBlock>\n <ExampleBlock title=\"固定底部\" noPadding>{render(9, fixed, { fixed: true, bordered: true, placeholder: true, safeAreaInsetBottom: true })}</ExampleBlock>\n </DemoGroup>\n <RootPortal>\n {notice ? <view className=\"ui-demo-page demo-cell-toast\" user-interaction-enabled={false}><text>{notice}</text></view> : null}\n {loading ? <view className=\"ui-demo-page demo-tabbar-loading\" user-interaction-enabled={false}><Loading /><text>Loading...</text></view> : null}\n {dialog ? <view className=\"ui-demo-page demo-root-portal-modal\" catchtap={() => { 'background only'; }}><view className=\"demo-tabbar-dialog\"><image className=\"demo-tabbar-dialog-image\" src={panda} mode=\"aspectFill\" /><view className=\"demo-tabbar-dialog-body\"><text className=\"demo-root-portal-modal-title\">发布动态</text><text className=\"demo-root-portal-modal-text\">选择你要发布的内容类型</text><Button label=\"确定\" round block onTap={() => { 'background only'; setDialog(false); }} /></view></view></view> : null}\n </RootPortal>\n </view>;\n}\n","props":[{"name":"items","type":"readonly TabbarItem[]","optional":false,"description":"子项数据,等宽排列","defaultValue":"必填"},{"name":"value","type":"TabbarValue","optional":true,"description":"对应 v-model,受控或非受控;严格匹配名称,否则使用索引"},{"name":"defaultValue","type":"TabbarValue","optional":true,"description":"对应 v-model,受控或非受控;严格匹配名称,否则使用索引","defaultValue":"0"},{"name":"beforeChange","type":"TabbarBeforeChange","optional":true,"description":"false、异常或拒绝均阻止切换;旧确认结果不会覆盖新点击"},{"name":"fixed","type":"boolean","optional":true,"description":"固定底部,按需在原位置保留等高占位","defaultValue":"false","values":[false,true]},{"name":"placeholder","type":"boolean","optional":true,"description":"固定底部,按需在原位置保留等高占位","defaultValue":"false","values":[false,true]},{"name":"bordered","type":"boolean","optional":true,"description":"默认形状的顶部细边框;round 忽略此项","defaultValue":"false","values":[false,true]},{"name":"safeAreaInsetBottom","type":"boolean","optional":true,"description":"启用宿主传入的底部安全区","defaultValue":"false","values":[false,true]},{"name":"bottomSafeAreaHeight","type":"number","optional":true,"description":"宿主安全距离,px;负数、非有限值按0处理","defaultValue":"0"},{"name":"shape","type":"'default' | 'round'","optional":true,"description":"round 水平外边距16px、圆角、阴影","defaultValue":"'default'","values":["default","round"]},{"name":"activeColor","type":"string","optional":true,"description":"文字与内置图标颜色;SVG 图标请传实际颜色值,如 #1c64fd"},{"name":"inactiveColor","type":"string","optional":true,"description":"文字与内置图标颜色;SVG 图标请传实际颜色值,如 #1c64fd"},{"name":"zIndex","type":"number","optional":true,"description":"固定定位层级","defaultValue":"10"},{"name":"className","type":"string","optional":true,"description":"根节点类名","defaultValue":"''"}],"events":[{"name":"onChange","type":"(event: { value: TabbarValue }) => void","optional":true,"description":"成功切换后触发;重复点击当前项不触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","基础标签栏"],"title":"基础标签栏","section":"组件类型","description":"通过 `items` 配置标签项,`value` 指定当前项,`onChange` 返回新的选中值。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<Tabbar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { name: 0, title: '首页', icon: 'home' },\n { name: 1, title: '我的', icon: 'user' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>(0);\n\n<Tabbar\n value={value}\n onChange={(event) => {\n 'background only';\n setValue(event.value);\n }}\n items={[\n { name: 0, title: '首页', icon: 'home' },\n { name: 1, title: '我的', icon: 'user' },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","固定底部"],"title":"固定底部","section":"布局能力","description":"设置 `fixed` 固定在底部,配合 `placeholder` 和 `safeAreaInsetBottom` 预留内容与安全区空间。","language":"tsx","code":"<Tabbar\n fixed\n placeholder\n safeAreaInsetBottom\n items={[\n { name: 'home', title: '首页', icon: 'home' },\n { name: 'me', title: '我的', icon: 'user' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Tabbar\n fixed\n placeholder\n safeAreaInsetBottom\n items={[\n { name: 'home', title: '首页', icon: 'home' },\n { name: 'me', title: '我的', icon: 'user' },\n ]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Table","id":"table","label":"Table 表格","category":"数据展示","categoryId":"display","kind":"component","description":"表格用于展示结构化数据,支持列配置、固定列、排序、合并单元格和固定行高的虚拟窗口。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Table.tsx","docPath":"docs/ui/components/table.md","doc":"# Table 表格\n\n表格用于展示结构化数据,支持列配置、固定列、排序、合并单元格和固定行高的虚拟窗口。\n\n```tsx\nimport { Table } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 基础表格\n\n通过 `data` 设置行数据,通过 `columns` 的 `prop` 和 `label` 配置列字段与表头。\n\n```tsx\n<Table\n data={[\n { name: '张三', score: 88 },\n { name: '李四', score: 95 },\n ]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数' },\n ]}\n/>\n```\n\n## 组件样式\n\n### 边框与表头\n\n设置 `border` 和 `stripe` 展示边框与斑马纹,`height` 限定可见高度,列设置 `fixed` 固定在左侧。\n\n```tsx\n<Table\n border\n stripe\n height={240}\n data={[{ name: '商品一', price: 99 }]}\n columns={[\n { prop: 'name', label: '商品', fixed: true },\n { prop: 'price', label: '价格' },\n ]}\n/>\n```\n\n## 交互用法\n\n### 监听排序\n\n在列上设置 `sortable`,通过 `onSortMethod` 获取排序字段与方向,再由调用方更新数据顺序。\n\n```tsx\n<Table\n data={[{ name: '张三', score: 88 }]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数', sortable: true },\n ]}\n onSortMethod={(column) => {\n 'background only';\n console.log(column.prop, column.sortDirection);\n }}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| data | 只读数组;组件不修改或排序原始数据 | `readonly T[]` | 必填 |\n| columns | 只读数组;组件不修改或排序原始数据 | `readonly TableColumn<T>[]` | 必填 |\n| border | 边框与斑马纹,表头随 stripe 着色 | `boolean` | `true` |\n| stripe | 边框与斑马纹,表头随 stripe 着色 | `boolean` | `true` |\n| height | 最大可见高度,不含外边框;设置后表体可纵向滚动。数字为 px,字符串为可解析的 Lynx 固定长度;高度百分比需要父级具有明确高度 | `number \\| string` | — |\n| rowHeight | 非虚拟模式最小行高,文本和自定义内容可撑高;虚拟模式为严格固定行高,单位 px | `number` | `44` |\n| showHeader | 是否展示、固定表头;无 height 时随页面自然滚动 | `boolean` | `true` |\n| ellipsis | 默认换行;开启后普通文本最多两行 | `boolean` | `false` |\n| index | true 或列配置;默认标题“序号”、宽 100rpx(13.333333vw),从 1 开始 | `boolean \\| Partial<TableColumn<T>>` | `false` |\n| fixedHeader | 是否展示、固定表头;无 height 时随页面自然滚动 | `boolean` | `true` |\n| cellPadding | 单元格内边距 px,数字或 [垂直,水平];原生测量与行高同步使用,富文本表格传 0 后由内容负责边距 | `number \\| readonly [number, number]` | — |\n| spanMethod | `({row,column,rowIndex,columnIndex}) => {rowspan,colspan}` 或 `[rowspan,colspan]`;0 隐藏单元格,调用方负责覆盖区域的 0 配置 | `(scope: TableSpanScope<T>) => TableSpan \\| readonly number[] \\| void` | — |\n| virtual | 有明确 height 时开启固定行高的缓冲窗口;不挂载全部行。虚拟模式不组合 rowspan/colspan,可用独立非虚拟表格展示合并行 | `boolean` | `false` |\n| buffer | 有明确 height 时开启固定行高的缓冲窗口;不挂载全部行。虚拟模式不组合 rowspan/colspan,可用独立非虚拟表格展示合并行 | `number` | `5` |\n| rowKey | 行属性名或 `(row,index)=>string\\|number`,编辑/重排场景请传稳定唯一值 | `keyof T \\| ((row: T, index: number) => string \\| number)` | — |\n| className | 根容器扩展 | `string` | `''` |\n| style | 根容器扩展 | `CSSProperties` | — |\n\n泛型约束:`T`。\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onSortMethod | 对应操作发生时触发 | (column: TableSortEvent<T>) => void |\n| onRowClick | 对应操作发生时触发 | (event: { rowIndex: number }) => void |\n\n## 数据类型\n\n```tsx\nexport type TableColumn<T> = {\n prop: keyof T & string;\n label?: string;\n width?: number | string;\n sortable?: boolean;\n fixed?: boolean;\n align?: 'left' | 'center' | 'right';\n render?: (scope: { row: T; index: number }) => ReactNode;\n};\n\nexport type TableSpanScope<T> = {\n row: T;\n column: TableColumn<T>;\n rowIndex: number;\n columnIndex: number;\n};\n\nexport type TableSpan = { rowspan: number; colspan: number };\n\nexport type TableSortEvent<T> = Omit<TableColumn<T>, 'render'> & {\n sortDirection: SortButtonValue;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-table-stripe-bg` | 当前组件 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Table 组件源码](./sources/table/Table.tsx.txt) · [示例源码](./sources/table/demo.tsx.txt) · [文档源码](./sources/table/docs.md.txt)\n","demoSource":"import { useMemo, useState } from '@lynx-js/react';\nimport { InputNumber, Pagination, Table } from 'daisu-ui';\nimport type { TableColumn, TableSpanScope } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\ntype Person = { name: string; grade: number; compare: string; hobby: string; school: string; major: string; gender: string; graduation: string };\nconst seeds = [\n ['关羽', 66, '48%', '颜良文丑,以吾观之,如土鸡瓦犬耳。', '绿豆'],\n ['刘备', 68, '21%', '我得空明,如鱼得水也', '编织'],\n ['赵云', 91, '12%', '子龙,子龙,世无双', '妇幼保健'],\n ['赵云', 91, '12%', '子龙,子龙,世无双', '妇幼保健'],\n ['孔明', 99, '18%', '兴汉讨贼,克复中原', '卧龙'],\n];\nconst original: Person[] = [...seeds, [ ...seeds[2]!.slice(0, 1), 36, '48%', ...seeds[2]!.slice(3) ], ...seeds.slice(0, 3), seeds[4]!, [ ...seeds[2]!.slice(0, 1), 36, '48%', ...seeds[2]!.slice(3) ], ...seeds.slice(0, 3), seeds[4]!].map(row => ({ name: String(row[0]), grade: Number(row[1]), compare: String(row[2]), hobby: String(row[3]), school: `武汉市阳逻${row[4]}学院`, major: '计算机科学与技术专业', gender: '男', graduation: '2022年1月12日' }));\nconst basic: TableColumn<Person>[] = [{ prop: 'name', label: '姓名', width: '50%', align: 'center' }, { prop: 'grade', label: '分数', width: '50%', align: 'center' }];\nconst full: TableColumn<Person>[] = [{ prop: 'name', label: '姓名', align: 'center', sortable: true, fixed: true }, { prop: 'grade', label: '分数', align: 'center', sortable: true, fixed: true }, { prop: 'hobby', label: '一言以蔽之', width: 160, sortable: true }, { prop: 'school', label: '求学之所', width: 180 }, { prop: 'major', label: '专业' }, { prop: 'gender', label: '性别' }];\nconst narrow: TableColumn<Person>[] = [{ prop: 'name', label: '姓名', align: 'center' }, { prop: 'grade', label: '分数', align: 'center' }, { prop: 'school', label: '求学之所' }, { prop: 'major', label: '专业' }];\nconst grade: TableColumn<Person>['render'] = ({ row }) => <view className=\"demo-table-custom\"><text className=\"ui-table-value\">{row.grade}</text><text className=\"ui-table-value\">{`同比${row.compare}`}</text></view>;\nfunction spanBasic({ rowIndex: r, columnIndex: c }: TableSpanScope<Person>) { if (r === 0 && c === 0) return [1, 2]; if (r === 0 && c === 1 || r === 3 && c === 0) return [0, 0]; if (r === 2 && c === 0) return [2, 1]; }\nfunction spanCustom({ rowIndex: r, columnIndex: c }: TableSpanScope<Person>) { if (r === 0 && c === 0) return [2, 1]; if (r === 1 && c === 0 || r === 3 && c === 3) return [0, 0]; if (r === 3 && c === 2) return [1, 2]; }\nfunction spanFixed({ rowIndex: r, columnIndex: c }: TableSpanScope<Person>) { if (r === 1 && c === 1) return [2, 1]; if (r === 2 && c === 1 || r === 3 && c === 4) return [0, 0]; if (r === 3 && c === 3) return [1, 2]; }\nfunction spanHeader({ rowIndex: r, columnIndex: c }: TableSpanScope<Person>) { if (r === 0 && c === 2 || r === 4 && c === 3) return [2, 1]; if (r === 1 && c === 2 || r === 5 && c === 3) return [0, 0]; }\nconst virtualColumns = [{ prop: 'index', label: '序号', width: 80, align: 'center' }, { prop: 'name', label: '姓名', width: 120, align: 'center' }, { prop: 'score', label: '分数', width: 100, align: 'center' }, { prop: 'remark', label: '备注', width: 200 }] as const;\nexport function TableExample() {\n const [data, setData] = useState(original), [page, setPage] = useState(1);\n const [quantities, setQuantities] = useState(() => Array.from({ length: 200 }, (_, i) => ({ id: i + 1, quantity: i % 10 })));\n const soldiers = useMemo(() => Array.from({ length: 10000 }, (_, i) => ({ index: i + 1, name: `蜀兵${i + 1}号`, score: (i * 37 + 6) % 100, remark: `这是蜀兵${i + 1}号的备注信息` })), []);\n const editable = useMemo<TableColumn<(typeof quantities)[number]>[]>(() => [{ prop: 'id', label: '姓名', width: 'calc(100% - 220px)', render: ({ row, index }) => <view><text className=\"ui-table-value\">{`蜀兵${row.id}号`}</text><text className=\"demo-table-position\">{`第 ${index + 1} 行`}</text></view> }, { prop: 'quantity', label: '数量', width: 160, align: 'center', render: ({ row }) => <InputNumber value={row.quantity} min={0} max={99} onChange={({ value }) => { 'background only'; setQuantities(previous => previous.map(item => item.id === row.id ? { ...item, quantity: Number(value) } : item)); }} /> }], []);\n const reverse = () => { 'background only'; setData(previous => [...previous].reverse()); };\n const first = data.slice(0, 5);\n return <view className=\"demo-table-page\"><DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><Table data={data} columns={basic} height={400} /></ExampleBlock>\n <ExampleBlock title=\"固定列\"><Table data={data} columns={full} height={400} onSortMethod={reverse} /></ExampleBlock>\n <ExampleBlock title=\"显示索引\"><Table data={data} columns={full.map(col => ({ ...col, fixed: false }))} height={400} index={{ align: 'center' }} onSortMethod={reverse} /></ExampleBlock>\n <ExampleBlock title=\"自定义列模板\"><Table data={data} columns={[...full.map(col => col.prop === 'grade' ? { ...col, render: grade } : col), { prop: 'graduation', label: '学成时间' }]} height={400} onSortMethod={reverse} /></ExampleBlock>\n <ExampleBlock title=\"合并单元格\"><Table data={first} columns={narrow} height={400} spanMethod={spanBasic} /></ExampleBlock>\n <ExampleBlock title=\"合并单元格与自定义列模板\"><Table data={first} columns={[full[0]!, { ...full[1]!, fixed: false, sortable: false, render: grade }, ...full.slice(2, 5).map(col => ({ ...col, sortable: false }))]} height={400} spanMethod={spanCustom} onSortMethod={reverse} /></ExampleBlock>\n <ExampleBlock title=\"固定列与合并单元格\"><Table data={first} columns={full.map((col, i) => ({ ...col, sortable: false, fixed: i === 0 }))} height={400} spanMethod={spanFixed} /></ExampleBlock>\n <ExampleBlock title=\"固定表头与合并单元格\"><Table data={data} columns={narrow} height={300} spanMethod={spanHeader} /></ExampleBlock>\n <ExampleBlock title=\"虚拟滚动\"><text className=\"demo-table-hint\">共 10000 行,可持续滚动至最后一行。</text><Table data={soldiers} columns={virtualColumns} height={400} virtual rowHeight={50} rowKey=\"index\" /></ExampleBlock>\n <ExampleBlock title=\"虚拟滚动与自定义列模板\"><text className=\"demo-table-hint\">调整任意行数量,滚动后返回,数量仍保留在对应行。</text><Table data={quantities} columns={editable} height={320} virtual rowHeight={64} index={{ fixed: true, width: 60, align: 'center' }} rowKey=\"id\" /></ExampleBlock>\n </DemoGroup><DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"无边框\"><Table data={data} columns={basic} height={400} border={false} /></ExampleBlock>\n <ExampleBlock title=\"无斑马纹\"><Table data={data} columns={basic} height={400} stripe={false} /></ExampleBlock>\n <ExampleBlock title=\"不展示表头\"><Table data={data} columns={basic} height={400} showHeader={false} /></ExampleBlock>\n </DemoGroup><DemoGroup title=\"特殊样式\"><ExampleBlock title=\"不固定表头结合分页器\"><Table data={data.slice((page - 1) * 10, page * 10)} columns={full.map(col => ({ ...col, sortable: false }))} fixedHeader={false} /><Pagination value={page} total={data.length} onChange={setPage} /></ExampleBlock></DemoGroup></view>;\n}\n","props":[{"name":"data","type":"readonly T[]","optional":false,"description":"只读数组;组件不修改或排序原始数据","defaultValue":"必填"},{"name":"columns","type":"readonly TableColumn<T>[]","optional":false,"description":"只读数组;组件不修改或排序原始数据","defaultValue":"必填"},{"name":"border","type":"boolean","optional":true,"description":"边框与斑马纹,表头随 stripe 着色","defaultValue":"true","values":[false,true]},{"name":"stripe","type":"boolean","optional":true,"description":"边框与斑马纹,表头随 stripe 着色","defaultValue":"true","values":[false,true]},{"name":"height","type":"number | string","optional":true,"description":"最大可见高度,不含外边框;设置后表体可纵向滚动。数字为 px,字符串为可解析的 Lynx 固定长度;高度百分比需要父级具有明确高度"},{"name":"rowHeight","type":"number","optional":true,"description":"非虚拟模式最小行高,文本和自定义内容可撑高;虚拟模式为严格固定行高,单位 px","defaultValue":"44"},{"name":"showHeader","type":"boolean","optional":true,"description":"是否展示、固定表头;无 height 时随页面自然滚动","defaultValue":"true","values":[false,true]},{"name":"ellipsis","type":"boolean","optional":true,"description":"默认换行;开启后普通文本最多两行","defaultValue":"false","values":[false,true]},{"name":"index","type":"boolean | Partial<TableColumn<T>>","optional":true,"description":"true 或列配置;默认标题“序号”、宽 100rpx(13.333333vw),从 1 开始","defaultValue":"false"},{"name":"fixedHeader","type":"boolean","optional":true,"description":"是否展示、固定表头;无 height 时随页面自然滚动","defaultValue":"true","values":[false,true]},{"name":"cellPadding","type":"number | readonly [number, number]","optional":true,"description":"单元格内边距 px,数字或 [垂直,水平];原生测量与行高同步使用,富文本表格传 0 后由内容负责边距"},{"name":"spanMethod","type":"(scope: TableSpanScope<T>) => TableSpan | readonly number[] | void","optional":true,"description":"({row,column,rowIndex,columnIndex}) => {rowspan,colspan} 或 [rowspan,colspan];0 隐藏单元格,调用方负责覆盖区域的 0 配置"},{"name":"virtual","type":"boolean","optional":true,"description":"有明确 height 时开启固定行高的缓冲窗口;不挂载全部行。虚拟模式不组合 rowspan/colspan,可用独立非虚拟表格展示合并行","defaultValue":"false","values":[false,true]},{"name":"buffer","type":"number","optional":true,"description":"有明确 height 时开启固定行高的缓冲窗口;不挂载全部行。虚拟模式不组合 rowspan/colspan,可用独立非虚拟表格展示合并行","defaultValue":"5"},{"name":"rowKey","type":"keyof T | ((row: T, index: number) => string | number)","optional":true,"description":"行属性名或 (row,index)=>string|number,编辑/重排场景请传稳定唯一值"},{"name":"className","type":"string","optional":true,"description":"根容器扩展","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根容器扩展"}],"events":[{"name":"onSortMethod","type":"(column: TableSortEvent<T>) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onRowClick","type":"(event: { rowIndex: number }) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-table-stripe-bg","defaultValue":"var(--cso-ui-canvas)","description":""},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","基础表格"],"title":"基础表格","section":"组件类型","description":"通过 `data` 设置行数据,通过 `columns` 的 `prop` 和 `label` 配置列字段与表头。","language":"tsx","code":"<Table\n data={[\n { name: '张三', score: 88 },\n { name: '李四', score: 95 },\n ]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Table\n data={[\n { name: '张三', score: 88 },\n { name: '李四', score: 95 },\n ]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数' },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","边框与表头"],"title":"边框与表头","section":"组件样式","description":"设置 `border` 和 `stripe` 展示边框与斑马纹,`height` 限定可见高度,列设置 `fixed` 固定在左侧。","language":"tsx","code":"<Table\n border\n stripe\n height={240}\n data={[{ name: '商品一', price: 99 }]}\n columns={[\n { prop: 'name', label: '商品', fixed: true },\n { prop: 'price', label: '价格' },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Table\n border\n stripe\n height={240}\n data={[{ name: '商品一', price: 99 }]}\n columns={[\n { prop: 'name', label: '商品', fixed: true },\n { prop: 'price', label: '价格' },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","监听排序"],"title":"监听排序","section":"交互用法","description":"在列上设置 `sortable`,通过 `onSortMethod` 获取排序字段与方向,再由调用方更新数据顺序。","language":"tsx","code":"<Table\n data={[{ name: '张三', score: 88 }]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数', sortable: true },\n ]}\n onSortMethod={(column) => {\n 'background only';\n console.log(column.prop, column.sortDirection);\n }}\n/>\n","blocks":[{"language":"tsx","code":"<Table\n data={[{ name: '张三', score: 88 }]}\n columns={[\n { prop: 'name', label: '姓名' },\n { prop: 'score', label: '分数', sortable: true },\n ]}\n onSortMethod={(column) => {\n 'background only';\n console.log(column.prop, column.sortDirection);\n }}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Tabs","id":"tabs","label":"Tab 标签页","category":"导航","categoryId":"navigation","kind":"component","description":"标签页用于在同一页面内切换内容,支持滑动标签、下划线、内容切换和吸顶。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Tabs.tsx","docPath":"docs/ui/components/tabs.md","doc":"# Tab 标签页\n\n标签页用于在同一页面内切换内容,支持滑动标签、下划线、内容切换和吸顶。\n\n```tsx\nimport { Tabs } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 标准标签页\n\n设置 `variant=\"standard\"`,通过 `items` 的 `title`、`name` 和 `children` 配置标签与内容。\n\n```tsx\n<Tabs\n variant=\"standard\"\n items={[\n { title: '标签一', name: 'one', children: <text>内容一</text> },\n { title: '标签二', name: 'two', children: <text>内容二</text> },\n ]}\n/>\n```\n\n## 交互用法\n\n### 受控切换\n\n通过 `value` 和 `onChange` 管理当前标签,选项设置 `disabled` 后不可选择。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('one');\n\n<Tabs\n variant=\"standard\"\n value={value}\n onChange={(next) => {\n 'background only';\n setValue(next);\n }}\n items={[\n { title: '标签一', name: 'one' },\n { title: '标签二', name: 'two' },\n { title: '禁用', name: 'three', disabled: true },\n ]}\n/>\n```\n\n## 组件样式\n\n### 自定义颜色\n\n通过 `color` 设置选中颜色,通过 `lineWidth` 设置指示线宽度。\n\n```tsx\n<Tabs\n variant=\"standard\"\n color=\"#f86100\"\n lineWidth={24}\n items={[{ title: '精选' }, { title: '推荐' }]}\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| items | 数据项配置 | `readonly TabsItem[]` | 必填 |\n| variant | 外观变体 | `'standard'` | — |\n| value | 当前值;传入后由调用方更新 | `TabsValue` | — |\n| defaultValue | 非受控模式的初始值 | `TabsValue` | `0` |\n| slidable | 标签栏滑动策略 | `'auto' \\| 'always'` | `'auto'` |\n| slidableNum | 开启滑动布局的标签数量 | `number` | `6` |\n| mapNum | 超过指定数量时展示标签导航 | `number` | `10` |\n| mapTitle | 标签导航标题 | `string` | `''` |\n| showScrollbar | 是否显示滚动条 | `boolean` | `false` |\n| sticky | 是否吸顶 | `boolean` | `false` |\n| offsetTop | 顶部偏移距离 | `number` | `0` |\n| swipeable | 是否允许滑动切换内容 | `boolean` | `false` |\n| animated | 是否启用切换动画 | `boolean` | `false` |\n| duration | 动画或显示时长,单位 ms | `number` | `300` |\n| lineTheme | 标签指示线外观 | `TabsLineTheme` | `'normal'` |\n| lineWidth | 指示线宽度 | `number \\| string` | — |\n| lineHeight | 行高或指示线高度 | `number \\| string` | — |\n| color | 内容颜色 | `string` | — |\n| inactiveColor | 未选中状态颜色 | `string` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| ref | 组件实例引用 | `Ref<TabsRef>` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (value: TabsValue, event: TabsEvent) => void |\n| onClick | 点击时触发 | (event: TabsEvent) => void |\n| onDisabled | 对应操作发生时触发 | (event: TabsEvent) => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| setActive | 调用实例方法 | (value: TabsValue) => void |\n| scrollIntoView | 调用实例方法 | () => void |\n| updateLineStyle | 调用实例方法 | () => void |\n\n## 数据类型\n\n```tsx\nexport type TabsItem = {\n name?: TabsValue;\n title: string;\n disabled?: boolean;\n lazy?: boolean;\n badgeProps?: Omit<BadgeProps, 'children'>;\n children?: ReactNode;\n className?: string;\n};\n\nexport type TabsValue = string | number;\n\nexport type TabsEvent = { index: number; name: TabsValue };\n\nexport type TabsLineTheme = 'normal' | 'text' | 'underline' | 'dot';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Tabs 组件源码](./sources/tabs/Tabs.tsx.txt) · [示例源码](./sources/tabs/demo.tsx.txt) · [文档源码](./sources/tabs/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Popup, Tabs, Toast, useToast } from 'daisu-ui';\nimport type { StandardTabsProps, TabsItem, TabsLineTheme, TabsValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction Sample({ count = 4, initial = 0, names, numeric = false, next = false, badge = false, disabledFirst = false, ...props }: Omit<StandardTabsProps, 'items'> & { count?: number; initial?: TabsValue; names?: readonly string[]; numeric?: boolean; next?: boolean; badge?: boolean; disabledFirst?: boolean }) {\n const [value, setValue] = useState<TabsValue>(initial);\n const labels = names ?? Array.from({ length: count }, (_, i) => `标签${i + 1}`);\n const numbers = [-1, 0, 1, 3, 2];\n const items: TabsItem[] = labels.map((title, i) => ({ title, name: numeric ? numbers[i] : names ? title : undefined, disabled: disabledFirst ? i === 0 : numeric ? numbers[i] === 0 : false, badgeProps: badge ? i === 0 ? { value: 10, right: '-8px' } : i === 1 ? { value: 100, max: 99, right: '-8px' } : { isDot: true, right: '-8px' } : undefined, children: <view className={`demo-tabs-content ${next ? 'demo-tabs-content-next' : ''}`}><text className=\"demo-tabs-copy\">{badge ? `${title}徽标` : `内容${numeric ? numbers[i] : names ? title : i + 1}`}</text>{next ? <Button label=\"下一个\" onTap={() => { 'background only'; setValue((Number(value) + 1) % count); }} /> : null}</view> }));\n return <Tabs {...props} style={props.sticky ? { paddingBottom: '4px' } : undefined} items={items} value={value} onChange={(v, e) => { 'background only'; setValue(v); props.onChange?.(v, e); }} />;\n}\nexport function TabsExample() {\n const [popup, setPopup] = useState(false); const [legacy, setLegacy] = useState('all'); const toast = useToast();\n const themes: TabsLineTheme[] = ['normal', 'text', 'underline', 'dot'];\n return <view className=\"demo-tabs-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\" noPadding><Sample next /></ExampleBlock>\n <ExampleBlock title=\"name匹配\" noPadding><Sample names={['this', 'is', 'a', 'individual', 'example']} initial=\"a\" /></ExampleBlock>\n <ExampleBlock title=\"name匹配 (数字类型)\" noPadding><Sample count={5} names={[-1, 0, 1, 3, 2].map(n => `标签${n}`)} numeric initial={-1} mapNum={5} swipeable /></ExampleBlock>\n <ExampleBlock title=\"使用徽标\" noPadding><Sample names={['普通数值', '最大值', '点状']} initial=\"普通数值\" badge /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"粘性布局\" noPadding><Sample sticky /></ExampleBlock><ExampleBlock title=\"禁用tab\" noPadding><Sample disabledFirst initial={1} /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"底部条样式\" noPadding>{themes.map(lineTheme => <view key={lineTheme} className=\"demo-tabs-theme\"><Sample names={Array.from({ length: 4 }, (_, i) => `${lineTheme} ${i + 1}`)} initial={`${lineTheme} 1`} lineTheme={lineTheme} /></view>)}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"点击事件\" noPadding><Sample onClick={e => { 'background only'; toast.show(`点击了标签${e.index + 1}`); }} /></ExampleBlock>\n <ExampleBlock title=\"切换动画\" noPadding><Sample animated /></ExampleBlock>\n <ExampleBlock title=\"手势滑动\" noPadding><Sample animated swipeable /></ExampleBlock>\n <ExampleBlock title=\"数量大于6时可滚动\" noPadding><Sample count={7} /></ExampleBlock>\n <ExampleBlock title=\"左对齐超出即可滚动\" noPadding><Sample names={Array.from({ length: 5 }, (_, i) => `超大标签${i + 1}`)} initial=\"超大标签1\" slidable=\"always\" /></ExampleBlock>\n <ExampleBlock title=\"数量大于10时出现导航地图\" noPadding><Sample count={12} mapTitle=\"全部标签\" /></ExampleBlock>\n <ExampleBlock title=\"在弹出框中使用\"><view className=\"demo-tabs-open\"><Button label=\"打开弹窗\" onTap={() => { 'background only'; setPopup(true); }} /></view></ExampleBlock>\n <ExampleBlock title=\"原有默认样式\"><Tabs value={legacy} options={[{ label: '全部', value: 'all' }, { label: '进行中', value: 'active' }, { label: '已完成', value: 'done' }]} onChange={setLegacy} /></ExampleBlock>\n </DemoGroup>\n <Popup className=\"ui-demo-page demo-tabs-popup-panel\" show={popup} onChange={setPopup} rootPortal closable position=\"bottom\"><view className=\"demo-tabs-popup\"><text className=\"demo-tabs-popup-title\">在弹出框中使用</text><Sample names={['这', '是', '一', '个', '例子']} initial=\"个\" /></view></Popup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"items","type":"readonly TabsItem[]","optional":false,"description":"数据项配置","defaultValue":"必填"},{"name":"variant","type":"'standard'","optional":true,"description":"外观变体","values":["standard"]},{"name":"value","type":"TabsValue","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"TabsValue","optional":true,"description":"非受控模式的初始值","defaultValue":"0"},{"name":"slidable","type":"'auto' | 'always'","optional":true,"description":"标签栏滑动策略","defaultValue":"'auto'","values":["auto","always"]},{"name":"slidableNum","type":"number","optional":true,"description":"开启滑动布局的标签数量","defaultValue":"6"},{"name":"mapNum","type":"number","optional":true,"description":"超过指定数量时展示标签导航","defaultValue":"10"},{"name":"mapTitle","type":"string","optional":true,"description":"标签导航标题","defaultValue":"''"},{"name":"showScrollbar","type":"boolean","optional":true,"description":"是否显示滚动条","defaultValue":"false","values":[false,true]},{"name":"sticky","type":"boolean","optional":true,"description":"是否吸顶","defaultValue":"false","values":[false,true]},{"name":"offsetTop","type":"number","optional":true,"description":"顶部偏移距离","defaultValue":"0"},{"name":"swipeable","type":"boolean","optional":true,"description":"是否允许滑动切换内容","defaultValue":"false","values":[false,true]},{"name":"animated","type":"boolean","optional":true,"description":"是否启用切换动画","defaultValue":"false","values":[false,true]},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"300"},{"name":"lineTheme","type":"TabsLineTheme","optional":true,"description":"标签指示线外观","defaultValue":"'normal'","values":["text","underline","normal","dot"]},{"name":"lineWidth","type":"number | string","optional":true,"description":"指示线宽度"},{"name":"lineHeight","type":"number | string","optional":true,"description":"行高或指示线高度"},{"name":"color","type":"string","optional":true,"description":"内容颜色"},{"name":"inactiveColor","type":"string","optional":true,"description":"未选中状态颜色"},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"ref","type":"Ref<TabsRef>","optional":true,"description":"组件实例引用"}],"events":[{"name":"onChange","type":"(value: TabsValue, event: TabsEvent) => void","optional":true,"description":"值发生变化时触发"},{"name":"onClick","type":"(event: TabsEvent) => void","optional":true,"description":"点击时触发"},{"name":"onDisabled","type":"(event: TabsEvent) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"setActive","description":"调用实例方法","type":"(value: TabsValue) => void"},{"name":"scrollIntoView","description":"调用实例方法","type":"() => void"},{"name":"updateLineStyle","description":"调用实例方法","type":"() => void"}],"cssVars":[{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","标准标签页"],"title":"标准标签页","section":"组件类型","description":"设置 `variant=\"standard\"`,通过 `items` 的 `title`、`name` 和 `children` 配置标签与内容。","language":"tsx","code":"<Tabs\n variant=\"standard\"\n items={[\n { title: '标签一', name: 'one', children: <text>内容一</text> },\n { title: '标签二', name: 'two', children: <text>内容二</text> },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"<Tabs\n variant=\"standard\"\n items={[\n { title: '标签一', name: 'one', children: <text>内容一</text> },\n { title: '标签二', name: 'two', children: <text>内容二</text> },\n ]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","受控切换"],"title":"受控切换","section":"交互用法","description":"通过 `value` 和 `onChange` 管理当前标签,选项设置 `disabled` 后不可选择。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('one');\n\n<Tabs\n variant=\"standard\"\n value={value}\n onChange={(next) => {\n 'background only';\n setValue(next);\n }}\n items={[\n { title: '标签一', name: 'one' },\n { title: '标签二', name: 'two' },\n { title: '禁用', name: 'three', disabled: true },\n ]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState<string | number>('one');\n\n<Tabs\n variant=\"standard\"\n value={value}\n onChange={(next) => {\n 'background only';\n setValue(next);\n }}\n items={[\n { title: '标签一', name: 'one' },\n { title: '标签二', name: 'two' },\n { title: '禁用', name: 'three', disabled: true },\n ]}\n/>\n"}]},{"name":"demo-3","aliases":["demo-3","自定义颜色"],"title":"自定义颜色","section":"组件样式","description":"通过 `color` 设置选中颜色,通过 `lineWidth` 设置指示线宽度。","language":"tsx","code":"<Tabs\n variant=\"standard\"\n color=\"#f86100\"\n lineWidth={24}\n items={[{ title: '精选' }, { title: '推荐' }]}\n/>\n","blocks":[{"language":"tsx","code":"<Tabs\n variant=\"standard\"\n color=\"#f86100\"\n lineWidth={24}\n items={[{ title: '精选' }, { title: '推荐' }]}\n/>\n"}]}],"allowUnknownProps":false},{"name":"Tag","id":"tag","label":"Tag 标签","category":"数据展示","categoryId":"display","kind":"component","description":"标签用于展示分类和状态,支持语义颜色、外观、图标、关闭和动态输入。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Tag.tsx","docPath":"docs/ui/components/tag.md","doc":"# Tag 标签\n\n标签用于展示分类和状态,支持语义颜色、外观、图标、关闭和动态输入。\n\n```tsx\nimport { Tag } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 语义标签\n\n通过 `type` 设置标签的语义颜色,通过 `label` 设置文字。\n\n```tsx\n<Tag type=\"primary\" label=\"主要标签\" />\n<Tag type=\"success\" label=\"已完成\" />\n<Tag type=\"danger\" label=\"待处理\" />\n```\n\n## 组件样式\n\n### 圆角与镂空\n\n设置 `round` 使用圆角,设置 `plain` 使用镂空样式。\n\n```tsx\n<Tag type=\"primary\" round label=\"圆角标签\" />\n<Tag type=\"primary\" plain label=\"镂空标签\" />\n```\n\n## 交互用法\n\n### 关闭标签\n\n设置 `closable` 显示关闭入口,通过 `onClose` 更新标签的显示状态。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [show, setShow] = useState(true);\n\nshow ? (\n<Tag\nclosable\nlabel=\"可关闭\"\nonClose={() => {\n'background only';\nsetShow(false);\n}}\n/>\n) : null\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | default、primary、danger、warning、success、volcano、lightblue、cyan、pink、purple | `TagType` | — |\n| size | small、medium、default、large、extra-large;字体11/12/12/14/14px,行高16/18/18/18/20px | `TagSize` | — |\n| variant | dark实色、light浅色、plain镂空、dashed虚线、text纯文本 | `TagVariant` | — |\n| tone | info映射primary、neutral映射default,其余tone映射同名type;plain映射variant=plain;显式type与variant优先 | `TagTone` | — |\n| plain | info映射primary、neutral映射default,其余tone映射同名type;plain映射variant=plain;显式type与variant优先 | `boolean` | — |\n| label | children优先;纯文本自动包裹text,保留旧label接口 | `string` | `''` |\n| children | children优先;纯文本自动包裹text,保留旧label接口 | `ReactNode` | — |\n| icon | 公共SVG图标或自定义图标;iconSlot优先 | `string` | `''` |\n| iconSlot | 公共SVG图标或自定义图标;iconSlot优先 | `ReactNode` | — |\n| add | 自定义新增按钮内容,默认plus图标与“新增标签”;dynamic时生效 | `ReactNode` | — |\n| color | 内容文字与内置图标色 / 实色浅色背景及镂空虚线边框色;color不修改边框 | `string` | — |\n| bgColor | 内容文字与内置图标色 / 实色浅色背景及镂空虚线边框色;color不修改边框 | `string` | — |\n| round | 胶囊圆角并增加左右内边距 / 8px与4px交错圆角;同时设置时mark形状优先 | `boolean` | — |\n| mark | 胶囊圆角并增加左右内边距 / 8px与4px交错圆角;同时设置时mark形状优先 | `boolean` | `false` |\n| closable | 包括方形在内均可关闭;只发onClose,调用方负责移除 | `boolean` | `false` |\n| dynamic | 点击挂载原生input并聚焦;确认发onConfirm,失焦取消;下一次输入从空值开始 | `boolean` | `false` |\n| className | 根样式;颜色传color以覆盖内部内容 | `string` | `''` |\n| style | 根样式;颜色传color以覆盖内部内容 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onTap | 标签 / 关闭按钮回调;关闭使用catchtap阻止触发标签点击,dynamic进入编辑时不发onTap | () => void |\n| onClose | 标签 / 关闭按钮回调;关闭使用catchtap阻止触发标签点击,dynamic进入编辑时不发onTap | () => void |\n| onConfirm | 原样返回输入,包含空串,不自动trim或更新标签列表;确认后原生blur不会重复提交 | (detail: { value: string }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | children优先;纯文本自动包裹text,保留旧label接口 | ReactNode |\n| iconSlot | 公共SVG图标或自定义图标;iconSlot优先 | ReactNode |\n| add | 自定义新增按钮内容,默认plus图标与“新增标签”;dynamic时生效 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type TagType =\n | 'default'\n | 'primary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'volcano'\n | 'lightblue'\n | 'cyan'\n | 'pink'\n | 'purple';\n\nexport type TagSize = 'small' | 'medium' | 'default' | 'large' | 'extra-large';\n\nexport type TagVariant = 'light' | 'dark' | 'plain' | 'dashed' | 'text';\n\nexport type TagTone =\n | 'primary'\n | 'success'\n | 'info'\n | 'warning'\n | 'danger'\n | 'neutral';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-tag-default-color` | 当前组件 |\n| `--cso-ui-tag-light-cyan-bg` | 当前组件 |\n| `--cso-ui-tag-light-danger-bg` | 当前组件 |\n| `--cso-ui-tag-light-default-bg` | 当前组件 |\n| `--cso-ui-tag-light-lightblue-bg` | 当前组件 |\n| `--cso-ui-tag-light-pink-bg` | 当前组件 |\n| `--cso-ui-tag-light-primary-bg` | 当前组件 |\n| `--cso-ui-tag-light-purple-bg` | 当前组件 |\n| `--cso-ui-tag-light-success-bg` | 当前组件 |\n| `--cso-ui-tag-light-volcano-bg` | 当前组件 |\n| `--cso-ui-tag-light-warning-bg` | 当前组件 |\n\n## 源代码\n\n[Tag 组件源码](./sources/tag/Tag.tsx.txt) · [示例源码](./sources/tag/demo.tsx.txt) · [文档源码](./sources/tag/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Icon, Tag } from 'daisu-ui';\nimport type { TagProps, TagType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst types: readonly TagType[] = ['default', 'primary', 'danger', 'warning', 'success'];\nconst labels = ['标签', '常用标签', '危险标签', '警告标签', '成功标签'];\nfunction Tags({ named = false, ...props }: TagProps & { named?: boolean }) {\n return <>{types.map((type, index) => <Tag key={type} type={type} {...props}>{named ? labels[index] : '标签'}</Tag>)}</>;\n}\n\nexport function TagExample() {\n const [closed, setClosed] = useState<readonly TagType[]>([]);\n const [tags, setTags] = useState([{ id: 1, value: '标签一' }, { id: 2, value: '标签二' }]);\n const [nextId, setNextId] = useState(3);\n const confirm = ({ value }: { value: string }) => {\n 'background only';\n if (!value) return;\n setTags(current => [...current, { id: nextId, value }]);\n setNextId(current => current + 1);\n };\n return <view className=\"demo-tag-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><view className=\"demo-tag-row\"><Tags />{(['volcano', 'lightblue', 'cyan', 'pink', 'purple'] as const).map((type, i) => <Tag key={type} type={type}>{['火山', '亮蓝', '青色', '粉色', '紫色'][i]}</Tag>)}</view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"标签尺寸\"><view className=\"demo-tag-row demo-tag-sizes\">{(['small', 'medium', 'default', 'large', 'extra-large'] as const).map((size, i) => <Tag key={size} type=\"primary\" size={size}>{['小标签', '中标签', '默认标签', '较大标签', '特大标签'][i]}</Tag>)}</view></ExampleBlock>\n <ExampleBlock title=\"浅色标签\"><view className=\"demo-tag-row\"><Tags named variant=\"light\" /><Tag type=\"volcano\" variant=\"light\">火山</Tag><Tag type=\"lightblue\" variant=\"light\">亮蓝</Tag><Tag type=\"cyan\" variant=\"light\">青色</Tag></view></ExampleBlock>\n <ExampleBlock title=\"镂空变体\"><view className=\"demo-tag-row\"><Tags variant=\"plain\" /><Tag type=\"pink\" variant=\"plain\">粉色</Tag><Tag type=\"purple\" variant=\"plain\">紫色</Tag></view></ExampleBlock>\n <ExampleBlock title=\"虚线标签\"><view className=\"demo-tag-row\"><Tags named variant=\"dashed\" /></view></ExampleBlock>\n <ExampleBlock title=\"纯文本标签\"><view className=\"demo-tag-row\"><Tags named variant=\"text\" /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"标记标签\"><view className=\"demo-tag-row\"><Tags mark /></view></ExampleBlock>\n <ExampleBlock title=\"幽灵标记标签\"><view className=\"demo-tag-row\"><Tags mark variant=\"plain\" /></view></ExampleBlock>\n <ExampleBlock title=\"圆角标签\"><view className=\"demo-tag-row\"><Tags round /></view></ExampleBlock>\n <ExampleBlock title=\"设置图标\"><view className=\"demo-tag-row\"><Tag type=\"primary\" mark icon=\"clock-circle\">标签</Tag><Tag type=\"primary\" mark iconSlot={<Icon name=\"thunderbolt\" size={12} color=\"#fff\" />}>插槽</Tag></view></ExampleBlock>\n <ExampleBlock title=\"自定义颜色\"><view className=\"demo-tag-row\"><Tag color=\"#1c64fd\" bgColor=\"#f5f8ff\">标签</Tag><Tag color=\"#f57f00\" bgColor=\"#f57f00\" variant=\"plain\">标签</Tag><Tag color=\"#22b8cf\" bgColor=\"#22b8cf\" variant=\"dashed\">标签</Tag></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"可关闭\"><view className=\"demo-tag-row\">{types.filter(type => !closed.includes(type)).map(type => <Tag key={type} type={type} closable onClose={() => { 'background only'; setClosed(current => [...current, type]); }}>{['标签', '常用', '危险', '警告', '成功'][types.indexOf(type)]}</Tag>)}</view></ExampleBlock>\n <ExampleBlock title=\"新增标签\"><view className=\"demo-tag-row\">{tags.map(tag => <Tag key={tag.id} type=\"primary\" closable onClose={() => { 'background only'; setTags(current => current.filter(item => item.id !== tag.id)); }}>{tag.value}</Tag>)}<Tag type=\"primary\" dynamic onConfirm={confirm} /><Tag type=\"primary\" dynamic onConfirm={confirm} add={<><Icon name=\"pushpin\" color=\"#fff\" size={12} /><text className=\"demo-tag-add-label\">自定义</text></>} /></view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"type","type":"TagType","optional":true,"description":"default、primary、danger、warning、success、volcano、lightblue、cyan、pink、purple","values":["primary","success","warning","danger","default","volcano","lightblue","cyan","pink","purple"]},{"name":"size","type":"TagSize","optional":true,"description":"small、medium、default、large、extra-large;字体11/12/12/14/14px,行高16/18/18/18/20px","values":["small","medium","large","default","extra-large"]},{"name":"variant","type":"TagVariant","optional":true,"description":"dark实色、light浅色、plain镂空、dashed虚线、text纯文本","values":["plain","dashed","text","light","dark"]},{"name":"tone","type":"TagTone","optional":true,"description":"info映射primary、neutral映射default,其余tone映射同名type;plain映射variant=plain;显式type与variant优先","values":["primary","success","info","warning","danger","neutral"]},{"name":"plain","type":"boolean","optional":true,"description":"info映射primary、neutral映射default,其余tone映射同名type;plain映射variant=plain;显式type与variant优先","values":[false,true]},{"name":"label","type":"string","optional":true,"description":"children优先;纯文本自动包裹text,保留旧label接口","defaultValue":"''"},{"name":"icon","type":"string","optional":true,"description":"公共SVG图标或自定义图标;iconSlot优先","defaultValue":"''"},{"name":"iconSlot","type":"ReactNode","optional":true,"description":"公共SVG图标或自定义图标;iconSlot优先"},{"name":"add","type":"ReactNode","optional":true,"description":"自定义新增按钮内容,默认plus图标与“新增标签”;dynamic时生效"},{"name":"color","type":"string","optional":true,"description":"内容文字与内置图标色 / 实色浅色背景及镂空虚线边框色;color不修改边框"},{"name":"bgColor","type":"string","optional":true,"description":"内容文字与内置图标色 / 实色浅色背景及镂空虚线边框色;color不修改边框"},{"name":"round","type":"boolean","optional":true,"description":"胶囊圆角并增加左右内边距 / 8px与4px交错圆角;同时设置时mark形状优先","values":[false,true]},{"name":"mark","type":"boolean","optional":true,"description":"胶囊圆角并增加左右内边距 / 8px与4px交错圆角;同时设置时mark形状优先","defaultValue":"false","values":[false,true]},{"name":"closable","type":"boolean","optional":true,"description":"包括方形在内均可关闭;只发onClose,调用方负责移除","defaultValue":"false","values":[false,true]},{"name":"dynamic","type":"boolean","optional":true,"description":"点击挂载原生input并聚焦;确认发onConfirm,失焦取消;下一次输入从空值开始","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根样式;颜色传color以覆盖内部内容","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根样式;颜色传color以覆盖内部内容"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":"标签 / 关闭按钮回调;关闭使用catchtap阻止触发标签点击,dynamic进入编辑时不发onTap"},{"name":"onClose","type":"() => void","optional":true,"description":"标签 / 关闭按钮回调;关闭使用catchtap阻止触发标签点击,dynamic进入编辑时不发onTap"},{"name":"onConfirm","type":"(detail: { value: string }) => void","optional":true,"description":"原样返回输入,包含空串,不自动trim或更新标签列表;确认后原生blur不会重复提交"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"children优先;纯文本自动包裹text,保留旧label接口"},{"name":"iconSlot","type":"ReactNode","optional":true,"description":"公共SVG图标或自定义图标;iconSlot优先"},{"name":"add","type":"ReactNode","optional":true,"description":"自定义新增按钮内容,默认plus图标与“新增标签”;dynamic时生效"}],"methods":[],"cssVars":[{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-tag-default-color","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-tag-light-cyan-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-danger-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-default-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-lightblue-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-pink-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-primary-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-purple-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-success-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-volcano-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-warning-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","语义标签"],"title":"语义标签","section":"组件类型","description":"通过 `type` 设置标签的语义颜色,通过 `label` 设置文字。","language":"tsx","code":"<Tag type=\"primary\" label=\"主要标签\" />\n<Tag type=\"success\" label=\"已完成\" />\n<Tag type=\"danger\" label=\"待处理\" />\n","blocks":[{"language":"tsx","code":"<Tag type=\"primary\" label=\"主要标签\" />\n<Tag type=\"success\" label=\"已完成\" />\n<Tag type=\"danger\" label=\"待处理\" />\n"}]},{"name":"demo-2","aliases":["demo-2","圆角与镂空"],"title":"圆角与镂空","section":"组件样式","description":"设置 `round` 使用圆角,设置 `plain` 使用镂空样式。","language":"tsx","code":"<Tag type=\"primary\" round label=\"圆角标签\" />\n<Tag type=\"primary\" plain label=\"镂空标签\" />\n","blocks":[{"language":"tsx","code":"<Tag type=\"primary\" round label=\"圆角标签\" />\n<Tag type=\"primary\" plain label=\"镂空标签\" />\n"}]},{"name":"demo-3","aliases":["demo-3","关闭标签"],"title":"关闭标签","section":"交互用法","description":"设置 `closable` 显示关闭入口,通过 `onClose` 更新标签的显示状态。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [show, setShow] = useState(true);\n\nshow ? (\n<Tag\nclosable\nlabel=\"可关闭\"\nonClose={() => {\n'background only';\nsetShow(false);\n}}\n/>\n) : null\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [show, setShow] = useState(true);\n\nshow ? (\n<Tag\nclosable\nlabel=\"可关闭\"\nonClose={() => {\n'background only';\nsetShow(false);\n}}\n/>\n) : null\n"}]}],"allowUnknownProps":false},{"name":"Text","id":"text","label":"Text 文本","category":"基础","categoryId":"basic","kind":"component","description":"文本用于展示普通文字、语义状态、格式化金额和脱敏信息,支持多行截断与前后内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Text.tsx","docPath":"docs/ui/components/text.md","doc":"# Text 文本\n\n文本用于展示普通文字、语义状态、格式化金额和脱敏信息,支持多行截断与前后内容。\n\n```tsx\nimport { Text } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 普通文本与语义颜色\n\n通过 `text` 设置文字,使用 `type` 区分普通、成功和错误等语义状态。\n\n```tsx\n<Text text=\"这是一段正文\" />\n<Text text=\"操作成功\" type=\"success\" />\n<Text text=\"请检查输入\" type=\"error\" />\n```\n\n## 内容形态\n\n### 格式化与脱敏\n\n设置 `mode` 选择格式化方式,配合 `format` 对手机号等信息脱敏。\n\n```tsx\n<Text text=\"18888888888\" mode=\"phone\" format />\n<Text text=\"12345.67\" mode=\"price\" prefix=\"¥\" />\n```\n\n## 组件样式\n\n### 字号与行数\n\n通过 `size` 和 `lineHeight` 设置字号与行高,`lines` 限制显示行数,`bold` 设置粗体。\n\n```tsx\n<Text\n text=\"长文本会根据设置的行数截断展示。\"\n size={16}\n lineHeight={24}\n lines={2}\n bold\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| text | 文本内容 | `string \\| number` | 必填 |\n| type | 语义主题 | `'primary' \\| 'error' \\| 'warning' \\| 'success' \\| 'default'` | `'default'` |\n| mode | date 为毫秒时间戳、本地时区 YYYY-MM-DD;price 为千分位、两位小数 | `TextMode` | `'text'` |\n| format | phone 保留前三后四位;name 保留首尾字,中间 ** | `boolean` | `false` |\n| color | 自定义文字样式 | `string` | — |\n| size | 自定义文字样式 | `string \\| number` | — |\n| bold | 粗体、1–5 行截断;使用 Lynx text-maxline | `boolean` | `false` |\n| lines | 粗体、1–5 行截断;使用 Lynx text-maxline | `number` | — |\n| lineHeight | 自定义文字样式 | `string \\| number` | — |\n| decoration | 文字装饰 | `'none' \\| 'underline' \\| 'line-through'` | — |\n| prefix | 前后内容,节点须适用于 Lynx 内联 text | `ReactNode` | — |\n| suffix | 前后内容,节点须适用于 Lynx 内联 text | `ReactNode` | — |\n| className | 点击回调或自定义样式类名 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onTap | 点击回调或自定义样式类名 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 前后内容,节点须适用于 Lynx 内联 text | ReactNode |\n| suffix | 前后内容,节点须适用于 Lynx 内联 text | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type TextMode = 'text' | 'date' | 'phone' | 'name' | 'price';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 当前组件 |\n| `--cso-ui-text-muted` | 当前组件 |\n| `--cso-ui-warning` | 共享主题 |\n\n## 源代码\n\n[Text 组件源码](./sources/text/Text.tsx.txt) · [示例源码](./sources/text/demo.tsx.txt) · [文档源码](./sources/text/docs.md.txt)\n","demoSource":"import { Text } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst poem = '芦叶满汀洲,寒沙带浅流。二十年重过南楼。柳下系船犹未稳,能几日,又中秋。黄鹤断矶头,故人曾到否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。';\n\nexport function TextExample() {\n return <view className=\"demo-text-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><Text text={poem} /></ExampleBlock>\n <ExampleBlock title=\"设置主题\"><view className=\"demo-text-row\">{([{ type: 'primary', text: '主色' }, { type: 'error', text: '错误' }, { type: 'success', text: '成功' }, { type: 'warning', text: '警告' }, { type: 'default', text: '默认' }] as const).map(item => <Text key={item.type} {...item} />)}</view></ExampleBlock>\n <ExampleBlock title=\"模式\"><view><Text text=\"18888888888\" mode=\"phone\" /><Text text=\"王三\" mode=\"name\" /><Text text=\"1719976636911\" mode=\"date\" /></view></ExampleBlock>\n <ExampleBlock title=\"金额\"><Text text=\"16354.156\" mode=\"price\" type=\"success\" decoration=\"line-through\" prefix=\"¥\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义字体颜色\"><Text text={poem} color=\"var(--cso-ui-primary)\" /></ExampleBlock>\n <ExampleBlock title=\"是否粗体\"><Text text={poem} bold /></ExampleBlock>\n <ExampleBlock title=\"字体大小\"><Text text={poem} size={16} /></ExampleBlock>\n <ExampleBlock title=\"lines\"><Text text={poem} lines={2} size={16} /></ExampleBlock>\n <ExampleBlock title=\"lineHeight\"><Text text={poem} lines={2} lineHeight={24} /></ExampleBlock>\n <ExampleBlock title=\"文字装饰\"><Text text={poem} type=\"warning\" decoration=\"underline\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"脱敏\"><view className=\"demo-text-row\"><Text text=\"张长三\" mode=\"name\" format /><Text text=\"18888888888\" mode=\"phone\" format /></view></ExampleBlock>\n <ExampleBlock title=\"前后插槽\"><view><Text text=\"12345678901\" mode=\"phone\" format type=\"primary\" prefix=\"Prefix\" suffix=\"Suffix\" /><Text text=\"12345678901\" mode=\"phone\" format type=\"primary\" prefix={<text>Prefix</text>} suffix={<text>Suffix</text>} /></view></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"text","type":"string | number","optional":false,"description":"文本内容","defaultValue":"必填"},{"name":"type","type":"'primary' | 'error' | 'warning' | 'success' | 'default'","optional":true,"description":"语义主题","defaultValue":"'default'","values":["primary","success","warning","error","default"]},{"name":"mode","type":"TextMode","optional":true,"description":"date 为毫秒时间戳、本地时区 YYYY-MM-DD;price 为千分位、两位小数","defaultValue":"'text'","values":["text","date","phone","name","price"]},{"name":"format","type":"boolean","optional":true,"description":"phone 保留前三后四位;name 保留首尾字,中间 **","defaultValue":"false","values":[false,true]},{"name":"color","type":"string","optional":true,"description":"自定义文字样式"},{"name":"size","type":"string | number","optional":true,"description":"自定义文字样式"},{"name":"bold","type":"boolean","optional":true,"description":"粗体、1–5 行截断;使用 Lynx text-maxline","defaultValue":"false","values":[false,true]},{"name":"lines","type":"number","optional":true,"description":"粗体、1–5 行截断;使用 Lynx text-maxline"},{"name":"lineHeight","type":"string | number","optional":true,"description":"自定义文字样式"},{"name":"decoration","type":"'none' | 'underline' | 'line-through'","optional":true,"description":"文字装饰","values":["none","underline","line-through"]},{"name":"prefix","type":"ReactNode","optional":true,"description":"前后内容,节点须适用于 Lynx 内联 text"},{"name":"suffix","type":"ReactNode","optional":true,"description":"前后内容,节点须适用于 Lynx 内联 text"},{"name":"className","type":"string","optional":true,"description":"点击回调或自定义样式类名","defaultValue":"''"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":"点击回调或自定义样式类名"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"前后内容,节点须适用于 Lynx 内联 text"},{"name":"suffix","type":"ReactNode","optional":true,"description":"前后内容,节点须适用于 Lynx 内联 text"}],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"}],"demos":[{"name":"basic","aliases":["demo-1","普通文本与语义颜色"],"title":"普通文本与语义颜色","section":"组件类型","description":"通过 `text` 设置文字,使用 `type` 区分普通、成功和错误等语义状态。","language":"tsx","code":"<Text text=\"这是一段正文\" />\n<Text text=\"操作成功\" type=\"success\" />\n<Text text=\"请检查输入\" type=\"error\" />\n","blocks":[{"language":"tsx","code":"<Text text=\"这是一段正文\" />\n<Text text=\"操作成功\" type=\"success\" />\n<Text text=\"请检查输入\" type=\"error\" />\n"}]},{"name":"demo-2","aliases":["demo-2","格式化与脱敏"],"title":"格式化与脱敏","section":"内容形态","description":"设置 `mode` 选择格式化方式,配合 `format` 对手机号等信息脱敏。","language":"tsx","code":"<Text text=\"18888888888\" mode=\"phone\" format />\n<Text text=\"12345.67\" mode=\"price\" prefix=\"¥\" />\n","blocks":[{"language":"tsx","code":"<Text text=\"18888888888\" mode=\"phone\" format />\n<Text text=\"12345.67\" mode=\"price\" prefix=\"¥\" />\n"}]},{"name":"demo-3","aliases":["demo-3","字号与行数"],"title":"字号与行数","section":"组件样式","description":"通过 `size` 和 `lineHeight` 设置字号与行高,`lines` 限制显示行数,`bold` 设置粗体。","language":"tsx","code":"<Text\n text=\"长文本会根据设置的行数截断展示。\"\n size={16}\n lineHeight={24}\n lines={2}\n bold\n/>\n","blocks":[{"language":"tsx","code":"<Text\n text=\"长文本会根据设置的行数截断展示。\"\n size={16}\n lineHeight={24}\n lines={2}\n bold\n/>\n"}]}],"allowUnknownProps":false},{"name":"Textarea","id":"textarea","label":"Textarea 文本域","category":"录入","categoryId":"form","kind":"component","description":"文本域用于录入多行内容,支持高度控制、自动增高、清空和字数统计。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Textarea.tsx","docPath":"docs/ui/components/textarea.md","doc":"# Textarea 文本域\n\n文本域用于录入多行内容,支持高度控制、自动增高、清空和字数统计。\n\n```tsx\nimport { Textarea } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 多行输入\n\n通过 `value` 和 `onChange` 管理多行文本,`placeholder` 设置占位提示。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Textarea value={value} onChange={setValue} placeholder=\"请输入详细说明\" />\n```\n\n## 组件状态\n\n### 禁用与只读\n\n设置 `readonly` 使内容只读,设置 `disabled` 禁用文本域。\n\n```tsx\n<Textarea value=\"这是只读内容\" readonly />\n<Textarea value=\"这是禁用内容\" disabled />\n```\n\n## 组件样式\n\n### 自适应高度与字数\n\n设置 `autoHeight` 让高度随内容变化,通过 `minHeight` 和 `maxHeight` 限定范围;配合 `maxlength` 与 `showWordLimit` 显示字数。\n\n```tsx\n<Textarea\n autoHeight\n minHeight={100}\n maxHeight={240}\n maxlength={200}\n showWordLimit\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| error | 是否展示错误状态 | `boolean` | — |\n| focus | 是否获取输入焦点 | `boolean` | — |\n| value | 当前值;传入后由调用方更新 | `string \\| number` | — |\n| defaultValue | 非受控模式的初始值 | `string \\| number` | — |\n| placeholder | 占位内容或输入提示 | `string` | — |\n| maxlength | 最大输入长度,-1 表示不限制 | `number` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| readonly | 是否只读 | `boolean` | — |\n| clearable | 是否显示清空入口 | `boolean` | — |\n| clearTrigger | 清空入口显示条件 | `'always' \\| 'focus'` | — |\n| focusWhenClear | 清空后是否自动聚焦 | `boolean` | — |\n| compact | 紧凑布局 | `boolean` | — |\n| alignRight | 是否右对齐 | `boolean` | — |\n| prefixIcon | 前置图标名称 | `string` | — |\n| prefix | 前置内容 | `ReactNode` | — |\n| showWordLimit | 是否显示字数统计 | `boolean` | — |\n| confirmType | 键盘确认按钮类型 | `'done' \\| 'go' \\| 'next' \\| 'search' \\| 'send'` | — |\n| confirmHold | 确认后是否保持键盘 | `boolean` | — |\n| avoidKeyboard | 是否避让键盘 | `boolean` | — |\n| cursorSpacing | 光标与键盘之间的距离 | `number` | — |\n| softInputMode | 软键盘避让模式 | `'unspecified' \\| 'nothing' \\| 'pan' \\| 'resize'` | — |\n| holdKeyboard | 是否保持键盘显示 | `boolean` | — |\n| selectionStart | 文本选择开始位置 | `number` | — |\n| selectionEnd | 文本选择结束位置 | `number` | — |\n| placeholderColor | 占位文字颜色 | `string` | — |\n| inputFilter | 原生输入过滤表达式 | `string` | — |\n| showSoftInputOnFocus | 聚焦时是否打开系统键盘 | `boolean` | — |\n| ignoreCompositionEvent | 是否在输入法合成结束后统一更新值 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| inputClassName | 输入区域类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| autoHeight | 是否随内容自动增高 | `boolean` | — |\n| height | 高度 | `number` | — |\n| minHeight | 最小高度 | `number` | — |\n| maxHeight | 最大高度 | `number` | — |\n| maxlines | 最大显示行数 | `number` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (value: string) => void |\n| onInput | 原生输入事件 | (event: TextFieldEvent) => void |\n| onFocus | 获得焦点时触发 | (event: TextFieldEvent) => void |\n| onBlur | 失去焦点时触发 | (event: TextFieldEvent) => void |\n| onConfirm | 确认选择时触发 | (event: TextFieldEvent) => void |\n| onClear | 清空内容时触发 | () => void |\n| onClickPrefixIcon | 对应操作发生时触发 | () => void |\n| onClickSuffixIcon | 对应操作发生时触发 | () => void |\n| onTap | 点击时触发 | () => void |\n| onKeyboardHeightChange | 对应操作发生时触发 | (event: { height: number }) => void |\n| onLineChange | 对应操作发生时触发 | (event: { lineCount: number }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| prefix | 前置内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| focus | 获得焦点 | () => void |\n| blur | 失去焦点 | () => void |\n| setSelectionRange | 调用实例方法 | (start: number, end: number) => void |\n\n## 数据类型\n\n```tsx\nexport type TextFieldEvent = {\n value: string;\n selectionStart?: number;\n selectionEnd?: number;\n isComposing?: boolean;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Textarea 组件源码](./sources/textarea/Textarea.tsx.txt) · [示例源码](./sources/textarea/demo.tsx.txt) · [文档源码](./sources/textarea/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, Textarea } from 'daisu-ui';\nimport type { TextareaProps } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nfunction Sample({ defaultValue = '', ...props }: TextareaProps) { const [value, setValue] = useState<string | number>(defaultValue); return <Textarea {...props} value={value} onChange={setValue} />; }\nexport function TextareaExample() {\n return <view className=\"demo-textarea-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本使用\" noPadding><Sample placeholder=\"请填写评价\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"只读\" noPadding><Sample readonly clearable defaultValue=\"只读只读只度\" /></ExampleBlock><ExampleBlock title=\"禁用\" noPadding><Sample disabled clearable defaultValue=\"禁用禁用禁用\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"清空按钮 和 字数限制\" noPadding><Sample clearable maxlength={120} showWordLimit defaultValue=\"支持清空和字数限制的文本域\" /></ExampleBlock>\n <ExampleBlock title=\"有值且聚焦时展示清空按钮\" noPadding><Sample clearable clearTrigger=\"focus\" maxlength={120} showWordLimit /></ExampleBlock>\n <ExampleBlock title=\"点击清除按钮时不自动聚焦\" noPadding><Sample clearable focusWhenClear={false} maxlength={120} showWordLimit /></ExampleBlock>\n <ExampleBlock title=\"高度自适应\" noPadding><Sample autoHeight clearable defaultValue=\"输入文字后,输入框高度跟随字数多少变化\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"紧凑布局\"><Sample compact placeholder=\"请填写评价\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"结合表单使用\" noPadding><CellGroup border>\n <Cell title=\"基本用法\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" /></Cell>\n <Cell title=\"禁用\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" disabled defaultValue=\"该输入框禁用\" /></Cell>\n <Cell title=\"清空按钮\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" clearable /></Cell>\n <Cell title=\"高度自适应\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" autoHeight /></Cell>\n <Cell title=\"字数限制\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" maxlength={240} showWordLimit /></Cell>\n <Cell title=\"必填\" titleWidth=\"98px\" required><Sample compact placeholder=\"请输入\" /></Cell>\n <Cell title=\"只读\" titleWidth=\"98px\"><Sample compact placeholder=\"请输入\" readonly defaultValue=\"只读只读只度\" /></Cell>\n </CellGroup></ExampleBlock></DemoGroup>\n </view>;\n}\n","props":[{"name":"error","type":"boolean","optional":true,"description":"是否展示错误状态","values":[false,true]},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"value","type":"string | number","optional":true,"description":"当前值;传入后由调用方更新"},{"name":"defaultValue","type":"string | number","optional":true,"description":"非受控模式的初始值"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"placeholder","type":"string","optional":true,"description":"占位内容或输入提示"},{"name":"maxlength","type":"number","optional":true,"description":"最大输入长度,-1 表示不限制"},{"name":"readonly","type":"boolean","optional":true,"description":"是否只读","values":[false,true]},{"name":"clearable","type":"boolean","optional":true,"description":"是否显示清空入口","values":[false,true]},{"name":"clearTrigger","type":"'always' | 'focus'","optional":true,"description":"清空入口显示条件","values":["always","focus"]},{"name":"focusWhenClear","type":"boolean","optional":true,"description":"清空后是否自动聚焦","values":[false,true]},{"name":"compact","type":"boolean","optional":true,"description":"紧凑布局","values":[false,true]},{"name":"alignRight","type":"boolean","optional":true,"description":"是否右对齐","values":[false,true]},{"name":"prefixIcon","type":"string","optional":true,"description":"前置图标名称"},{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"},{"name":"showWordLimit","type":"boolean","optional":true,"description":"是否显示字数统计","values":[false,true]},{"name":"focus","type":"boolean","optional":true,"description":"是否获取输入焦点","values":[false,true]},{"name":"confirmType","type":"'done' | 'go' | 'next' | 'search' | 'send'","optional":true,"description":"键盘确认按钮类型","values":["send","done","go","next","search"]},{"name":"confirmHold","type":"boolean","optional":true,"description":"确认后是否保持键盘","values":[false,true]},{"name":"avoidKeyboard","type":"boolean","optional":true,"description":"是否避让键盘","values":[false,true]},{"name":"cursorSpacing","type":"number","optional":true,"description":"光标与键盘之间的距离"},{"name":"softInputMode","type":"'unspecified' | 'nothing' | 'pan' | 'resize'","optional":true,"description":"软键盘避让模式","values":["resize","unspecified","nothing","pan"]},{"name":"holdKeyboard","type":"boolean","optional":true,"description":"是否保持键盘显示","values":[false,true]},{"name":"selectionStart","type":"number","optional":true,"description":"文本选择开始位置"},{"name":"selectionEnd","type":"number","optional":true,"description":"文本选择结束位置"},{"name":"placeholderColor","type":"string","optional":true,"description":"占位文字颜色"},{"name":"inputFilter","type":"string","optional":true,"description":"原生输入过滤表达式"},{"name":"showSoftInputOnFocus","type":"boolean","optional":true,"description":"聚焦时是否打开系统键盘","values":[false,true]},{"name":"ignoreCompositionEvent","type":"boolean","optional":true,"description":"是否在输入法合成结束后统一更新值","values":[false,true]},{"name":"inputClassName","type":"string","optional":true,"description":"输入区域类名"},{"name":"autoHeight","type":"boolean","optional":true,"description":"是否随内容自动增高","values":[false,true]},{"name":"height","type":"number","optional":true,"description":"高度"},{"name":"minHeight","type":"number","optional":true,"description":"最小高度"},{"name":"maxHeight","type":"number","optional":true,"description":"最大高度"},{"name":"maxlines","type":"number","optional":true,"description":"最大显示行数"}],"events":[{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"},{"name":"onChange","type":"(value: string) => void","optional":true,"description":"值发生变化时触发"},{"name":"onInput","type":"(event: TextFieldEvent) => void","optional":true,"description":"原生输入事件"},{"name":"onFocus","type":"(event: TextFieldEvent) => void","optional":true,"description":"获得焦点时触发"},{"name":"onBlur","type":"(event: TextFieldEvent) => void","optional":true,"description":"失去焦点时触发"},{"name":"onConfirm","type":"(event: TextFieldEvent) => void","optional":true,"description":"确认选择时触发"},{"name":"onClear","type":"() => void","optional":true,"description":"清空内容时触发"},{"name":"onClickPrefixIcon","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onClickSuffixIcon","type":"() => void","optional":true,"description":"对应操作发生时触发"},{"name":"onKeyboardHeightChange","type":"(event: { height: number }) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onLineChange","type":"(event: { lineCount: number }) => void","optional":true,"description":"对应操作发生时触发"}],"slots":[{"name":"prefix","type":"ReactNode","optional":true,"description":"前置内容"}],"methods":[{"name":"focus","description":"获得焦点","type":"() => void"},{"name":"blur","description":"失去焦点","type":"() => void"},{"name":"setSelectionRange","description":"调用实例方法","type":"(start: number, end: number) => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","多行输入"],"title":"多行输入","section":"组件类型","description":"通过 `value` 和 `onChange` 管理多行文本,`placeholder` 设置占位提示。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Textarea value={value} onChange={setValue} placeholder=\"请输入详细说明\" />\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nconst [value, setValue] = useState('');\n\n<Textarea value={value} onChange={setValue} placeholder=\"请输入详细说明\" />\n"}]},{"name":"demo-2","aliases":["demo-2","禁用与只读"],"title":"禁用与只读","section":"组件状态","description":"设置 `readonly` 使内容只读,设置 `disabled` 禁用文本域。","language":"tsx","code":"<Textarea value=\"这是只读内容\" readonly />\n<Textarea value=\"这是禁用内容\" disabled />\n","blocks":[{"language":"tsx","code":"<Textarea value=\"这是只读内容\" readonly />\n<Textarea value=\"这是禁用内容\" disabled />\n"}]},{"name":"demo-3","aliases":["demo-3","自适应高度与字数"],"title":"自适应高度与字数","section":"组件样式","description":"设置 `autoHeight` 让高度随内容变化,通过 `minHeight` 和 `maxHeight` 限定范围;配合 `maxlength` 与 `showWordLimit` 显示字数。","language":"tsx","code":"<Textarea\n autoHeight\n minHeight={100}\n maxHeight={240}\n maxlength={200}\n showWordLimit\n/>\n","blocks":[{"language":"tsx","code":"<Textarea\n autoHeight\n minHeight={100}\n maxHeight={240}\n maxlength={200}\n showWordLimit\n/>\n"}]}],"allowUnknownProps":false},{"name":"Toast","id":"toast","label":"Toast 轻提示","category":"反馈","categoryId":"feedback","kind":"component","description":"轻提示用于短暂反馈操作结果,支持文字、成功、失败和持续加载等状态。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Toast.tsx","docPath":"docs/ui/components/toast.md","doc":"# Toast 轻提示\n\n轻提示用于短暂反馈操作结果,支持文字、成功、失败和持续加载等状态。\n\n```tsx\nimport { Toast } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 绑定提示实例\n\n调用 `useToast()`,将返回的 `props` 绑定到 `Toast`,通过 `show()` 显示文字提示。\n\n```tsx\nimport { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n```\n\n## 组件状态\n\n### 成功与加载\n\n通过 `success()` 显示成功提示,通过 `loading()` 显示持续加载,通过 `close()` 手动关闭。\n\n```tsx\nconst toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| msg | 消息正文 | `string` | — |\n| duration | 动画或显示时长,单位 ms | `number` | — |\n| direction | 布局或展开方向 | `ToastDirection` | — |\n| iconName | 状态图标类型 | `ToastIconType` | — |\n| iconSize | 图标尺寸 | `number` | — |\n| loadingType | 加载动画类型 | `ToastLoadingType` | — |\n| loadingColor | 加载指示器颜色 | `string` | — |\n| loadingSize | 加载指示器尺寸 | `number` | — |\n| iconColor | 图标颜色 | `string` | — |\n| position | 显示位置 | `ToastPosition` | — |\n| zIndex | 浮层层级 | `number` | — |\n| cover | 是否添加覆盖层 | `boolean` | — |\n| iconClass | A public Icon name or image URL, rather than an iconfont class. | `string` | — |\n| iconNode | 自定义图标内容 | `ReactNode` | — |\n| opened | 打开动画结束回调 | `() => void` | — |\n| closed | 关闭动画结束回调 | `() => void` | — |\n| show | 是否显示 | `boolean` | `false` |\n| options | 选项配置 | `ToastOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (show: boolean) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| iconNode | 自定义图标内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ToastDirection = 'horizontal' | 'vertical';\n\nexport type ToastIconType =\n | 'success'\n | 'error'\n | 'warning'\n | 'loading'\n | 'info';\n\nexport type ToastLoadingType = 'circular' | 'spinner' | 'dots';\n\nexport type ToastPosition = 'top' | 'middle-top' | 'middle' | 'bottom';\n\nexport type ToastOptions = {\n msg?: string;\n duration?: number;\n direction?: ToastDirection;\n iconName?: ToastIconType;\n iconSize?: number;\n loadingType?: ToastLoadingType;\n loadingColor?: string;\n loadingSize?: number;\n iconColor?: string;\n position?: ToastPosition;\n zIndex?: number;\n cover?: boolean;\n /** A public Icon name or image URL, rather than an iconfont class. */\n iconClass?: string;\n iconNode?: ReactNode;\n opened?: () => void;\n closed?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Toast 组件源码](./sources/toast/Toast.tsx.txt) · [示例源码](./sources/toast/demo.tsx.txt) · [文档源码](./sources/toast/docs.md.txt)\n","demoSource":"import { useEffect, useRef } from '@lynx-js/react';\nimport { Button, Toast, useToast } from 'daisu-ui';\nimport type { ToastLoadingType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport customIcon from '../../../assets/demo-recycle.svg';\n\nconst longText = '这是一段很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的文案';\nconst poem = '芦叶满汀洲,寒沙带浅流。二十年重过南楼。柳下系船犹未稳,能几日,又中秋。黄鹤断矶头,故人曾到否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。';\n\nexport function ToastExample() {\n const toast = useToast();\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => clearTimeout(timer.current), []);\n const run = (callback: () => void) => { 'background only'; clearTimeout(timer.current); callback(); };\n const loading = (type: ToastLoadingType, vertical = false) => run(() => {\n toast.loading({ msg: vertical ? poem : '3s后自动关闭', loadingType: type, direction: vertical ? 'vertical' : 'horizontal' });\n timer.current = setTimeout(toast.close, 3000);\n });\n return <view className=\"demo-toast-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><view className=\"demo-toast-buttons\"><Button label=\"toast\" onTap={() => run(() => toast.show('提示信息'))} /><Button label=\"长文案\" onTap={() => run(() => toast.show(longText))} /></view></ExampleBlock>\n <ExampleBlock title=\"类型toast\"><view className=\"demo-toast-buttons\"><Button label=\"成功toast\" onTap={() => run(() => toast.success('操作成功'))} /><Button label=\"错误toast\" onTap={() => run(() => toast.error('手机验证码输入错误,请重新输入'))} /><Button label=\"警告toast\" onTap={() => run(() => toast.warning('提示信息'))} /><Button label=\"常规toast\" onTap={() => run(() => toast.info('常规提示信息'))} /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"Loading\"><view className=\"demo-toast-buttons\">{(['circular', 'spinner', 'dots'] as const).map(type => <Button key={type} label={type === 'circular' ? 'circular (默认)' : type} onTap={() => loading(type)} />)}</view></ExampleBlock>\n <ExampleBlock title=\"纵向布局loading\"><view className=\"demo-toast-buttons\">{(['circular', 'spinner', 'dots'] as const).map(type => <Button key={type} label={type} onTap={() => loading(type, true)} />)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"使用图标\"><view className=\"demo-toast-buttons\"><Button label=\"内部图标\" onTap={() => run(() => toast.show({ iconClass: 'star', msg: '使用组件库内部图标' }))} /><Button label=\"自定义图标\" onTap={() => run(() => toast.show({ iconClass: customIcon, msg: '使用自定义图标' }))} /></view></ExampleBlock>\n <ExampleBlock title=\"提示位置\"><view className=\"demo-toast-buttons\">{(['top', 'middle', 'bottom'] as const).map((position, index) => <Button key={position} label={`${['顶部', '居中', '底部'][index]}toast`} onTap={() => run(() => toast.show({ position, msg: '提示信息' }))} />)}</view></ExampleBlock>\n <ExampleBlock title=\"排版方向\"><view className=\"demo-toast-buttons\">{(['horizontal', 'vertical'] as const).map((direction, index) => <Button key={direction} label={index ? '纵向排版' : '横向排版'} onTap={() => run(() => toast.success({ msg: poem, direction }))} />)}</view></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[{"name":"msg","type":"string","optional":true,"description":"消息正文"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms"},{"name":"direction","type":"ToastDirection","optional":true,"description":"布局或展开方向","values":["vertical","horizontal"]},{"name":"iconName","type":"ToastIconType","optional":true,"description":"状态图标类型","values":["success","info","warning","error","loading"]},{"name":"iconSize","type":"number","optional":true,"description":"图标尺寸"},{"name":"loadingType","type":"ToastLoadingType","optional":true,"description":"加载动画类型","values":["circular","spinner","dots"]},{"name":"loadingColor","type":"string","optional":true,"description":"加载指示器颜色"},{"name":"loadingSize","type":"number","optional":true,"description":"加载指示器尺寸"},{"name":"iconColor","type":"string","optional":true,"description":"图标颜色"},{"name":"position","type":"ToastPosition","optional":true,"description":"显示位置","values":["bottom","top","middle","middle-top"]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"cover","type":"boolean","optional":true,"description":"是否添加覆盖层","values":[false,true]},{"name":"iconClass","type":"string","optional":true,"description":"A public Icon name or image URL, rather than an iconfont class."},{"name":"iconNode","type":"ReactNode","optional":true,"description":"自定义图标内容"},{"name":"opened","type":"() => void","optional":true,"description":"打开动画结束回调"},{"name":"closed","type":"() => void","optional":true,"description":"关闭动画结束回调"},{"name":"show","type":"boolean","optional":true,"description":"是否显示","defaultValue":"false","values":[false,true]},{"name":"options","type":"ToastOptions","optional":true,"description":"选项配置"},{"name":"requestKey","type":"number","optional":true,"description":"重复请求标识,变化时重置当前展示","defaultValue":"0"},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onChange","type":"(show: boolean) => void","optional":true,"description":"值发生变化时触发"}],"slots":[{"name":"iconNode","type":"ReactNode","optional":true,"description":"自定义图标内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","绑定提示实例"],"title":"绑定提示实例","section":"基础用法","description":"调用 `useToast()`,将返回的 `props` 绑定到 `Toast`,通过 `show()` 显示文字提示。","language":"tsx","code":"import { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n","blocks":[{"language":"tsx","code":"import { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","成功与加载"],"title":"成功与加载","section":"组件状态","description":"通过 `success()` 显示成功提示,通过 `loading()` 显示持续加载,通过 `close()` 手动关闭。","language":"tsx","code":"const toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n","blocks":[{"language":"tsx","code":"const toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n"}]}],"allowUnknownProps":false},{"name":"Tooltip","id":"tooltip","label":"Tooltip 文字提示","category":"反馈","categoryId":"feedback","kind":"component","description":"文字提示用于解释图标或控件含义,在触发元素附近展示简短说明。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Tooltip.tsx","docPath":"docs/ui/components/tooltip.md","doc":"# Tooltip 文字提示\n\n文字提示用于解释图标或控件含义,在触发元素附近展示简短说明。\n\n```tsx\nimport { Tooltip } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 点击查看说明\n\n通过 `content` 设置说明文字,子节点作为提示的触发元素。\n\n```tsx\nimport { Button } from 'daisu-ui';\n\n<Tooltip content=\"这里是帮助信息\">\n <Button label=\"帮助\" />\n</Tooltip>\n```\n\n## 组件样式\n\n### 方向与关闭按钮\n\n通过 `placement` 指定提示方向,设置 `showClose` 显示关闭按钮。\n\n```tsx\n<Tooltip content=\"点击关闭按钮隐藏\" placement=\"top\" showClose>\n <Button label=\"顶部提示\" />\n</Tooltip>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| zIndex | 浮层层级 | `number` | — |\n| offset | 相对目标元素的偏移 | `BubbleOffset` | — |\n| disabled | 是否禁用 | `boolean` | — |\n| className | 根节点自定义类名 | `string` | — |\n| style | 根节点样式 | `CSSProperties` | — |\n| show | 是否显示 | `boolean` | — |\n| defaultShow | 非受控模式的初始显示状态 | `boolean` | — |\n| placement | 浮层相对触发元素的位置 | `BubblePlacement` | — |\n| visibleArrow | 是否显示气泡箭头 | `boolean` | — |\n| showClose | 是否显示关闭按钮 | `boolean` | — |\n| duration | 动画或显示时长,单位 ms | `number` | — |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | — |\n| arrowClassName | 气泡箭头类名 | `string` | — |\n| popClassName | 气泡面板类名 | `string` | — |\n| popStyle | 气泡面板样式 | `CSSProperties` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| contentNode | contentNode 配置 | `ReactNode` | — |\n| content | 内容 | `string` | `''` |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (event: { show: boolean }) => void |\n| onShowChange | 显示状态变化时触发 | (show: boolean) => void |\n| onOpen | 打开时触发 | () => void |\n| onClose | 关闭时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n| contentNode | 自定义区域内容 | ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | () => void |\n| close | 关闭面板 | () => void |\n| updatePosition | 重新计算位置 | () => void |\n\n## 数据类型\n\n```tsx\nexport type BubbleOffset =\n | number\n | readonly number[]\n | { x: number; y: number };\n\nexport type BubblePlacement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Tooltip 组件源码](./sources/tooltip/Tooltip.tsx.txt) · [示例源码](./sources/tooltip/demo.tsx.txt) · [文档源码](./sources/tooltip/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport { Button, Tooltip } from 'daisu-ui';\nimport type { BubblePlacement, TooltipRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function TooltipExample() {\n const refs = useRef<Record<string, TooltipRef | null>>({});\n const dynamic = useRef<TooltipRef>(null);\n const [width, setWidth] = useState(90);\n const [show, setShow] = useState(false);\n const closeAll = (except?: string) => { 'background only'; for (const [key, value] of Object.entries(refs.current)) if (key !== except) value?.close(); if (except !== 'dynamic') dynamic.current?.close(); };\n const props = (key: string) => ({ ref: (value: TooltipRef | null) => { 'background only'; refs.current[key] = value; }, onOpen: () => closeAll(key) });\n const button = (placement: BubblePlacement, label: string = placement) => <Tooltip key={placement} {...props(placement)} placement={placement} content={`${placement} 提示文字`}><Button label={label} /></Tooltip>;\n return <view className=\"demo-tooltip-page\" bindtap={() => closeAll()}>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\">\n <view className=\"demo-tooltip-top\">{button('bottom-start')}{button('bottom')}{button('bottom-end')}</view>\n <view className=\"demo-tooltip-sides\"><view className=\"demo-tooltip-side\">{button('right-start')}{button('right')}{button('right-end')}</view><view className=\"demo-tooltip-side\">{button('left-start', 'left-start\\u00a0')}{button('left')}{button('left-end')}</view></view>\n <view className=\"demo-tooltip-bottom\">{button('top-start')}{button('top')}{button('top-end')}</view>\n </ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"显示关闭按钮\"><Tooltip {...props('closable')} content=\"显示关闭按钮\" placement=\"right\" showClose><Button label=\"显示关闭按钮\" /></Tooltip></ExampleBlock>\n <ExampleBlock title=\"控制显隐\"><view className=\"demo-tooltip-control-trigger\" catchtap={() => {}}><Button label={show ? '关闭' : '打开'} size=\"small\" onTap={() => setShow(value => !value)} /></view><view className=\"demo-tooltip-controlled\"><Tooltip {...props('controlled')} show={show} onShowChange={setShow} placement=\"top\" content=\"控制显隐\"><Button label=\"top\" /></Tooltip></view></ExampleBlock>\n <ExampleBlock title=\"禁用\"><Tooltip disabled placement=\"right-end\" content=\"禁用\"><Button label=\"禁用\" /></Tooltip></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"多行文本\"><view className=\"demo-tooltip-lines-demo\"><Tooltip {...props('multiline')} placement=\"right\" contentNode={<view className=\"demo-tooltip-lines\">{[1, 2, 3].map(value => <text key={value}>多行文本{value}</text>)}</view>}><Button label=\"多行文本\" /></Tooltip></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"动态内容与位置更新\"><view className=\"demo-tooltip-lines-demo\"><Tooltip ref={dynamic} onOpen={() => closeAll('dynamic')} placement=\"right\" contentNode={<view className=\"demo-tooltip-lines\" style={{ width: `${width}px` }}><text className=\"demo-tooltip-width\">当前宽度: {width}px</text><Button label=\"改变大小\" size=\"small\" onTap={() => { 'background only'; setWidth(value => value === 90 ? 150 : 90); dynamic.current?.updatePosition(); }} /></view>}><Button label=\"动态内容\" /></Tooltip></view></ExampleBlock>\n <ExampleBlock title=\"绑定change事件\"><Tooltip {...props('events')} placement=\"right-end\" content=\"事件\" onChange={({ show: visible }) => { 'background only'; console.info('Tooltip change', visible); }}><Button label=\"事件\" /></Tooltip></ExampleBlock>\n </DemoGroup>\n </view>;\n}\n","props":[{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"offset","type":"BubbleOffset","optional":true,"description":"相对目标元素的偏移"},{"name":"disabled","type":"boolean","optional":true,"description":"是否禁用","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms"},{"name":"show","type":"boolean","optional":true,"description":"是否显示","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","values":[false,true]},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"defaultShow","type":"boolean","optional":true,"description":"非受控模式的初始显示状态","values":[false,true]},{"name":"placement","type":"BubblePlacement","optional":true,"description":"浮层相对触发元素的位置","values":["bottom","left","right","top","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"]},{"name":"visibleArrow","type":"boolean","optional":true,"description":"是否显示气泡箭头","values":[false,true]},{"name":"showClose","type":"boolean","optional":true,"description":"是否显示关闭按钮","values":[false,true]},{"name":"arrowClassName","type":"string","optional":true,"description":"气泡箭头类名"},{"name":"popClassName","type":"string","optional":true,"description":"气泡面板类名"},{"name":"popStyle","type":"CSSProperties","optional":true,"description":"气泡面板样式"},{"name":"contentNode","type":"ReactNode","optional":true,"description":"自定义区域内容"},{"name":"content","type":"string","optional":true,"description":"内容","defaultValue":"''"}],"events":[{"name":"onChange","type":"(event: { show: boolean }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onOpen","type":"() => void","optional":true,"description":"打开时触发"},{"name":"onClose","type":"() => void","optional":true,"description":"关闭时触发"},{"name":"onShowChange","type":"(show: boolean) => void","optional":true,"description":"显示状态变化时触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"},{"name":"contentNode","type":"ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"open","description":"打开面板","type":"() => void"},{"name":"close","description":"关闭面板","type":"() => void"},{"name":"updatePosition","description":"重新计算位置","type":"() => void"}],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","点击查看说明"],"title":"点击查看说明","section":"基础用法","description":"通过 `content` 设置说明文字,子节点作为提示的触发元素。","language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Tooltip content=\"这里是帮助信息\">\n <Button label=\"帮助\" />\n</Tooltip>\n","blocks":[{"language":"tsx","code":"import { Button } from 'daisu-ui';\n\n<Tooltip content=\"这里是帮助信息\">\n <Button label=\"帮助\" />\n</Tooltip>\n"}]},{"name":"demo-2","aliases":["demo-2","方向与关闭按钮"],"title":"方向与关闭按钮","section":"组件样式","description":"通过 `placement` 指定提示方向,设置 `showClose` 显示关闭按钮。","language":"tsx","code":"<Tooltip content=\"点击关闭按钮隐藏\" placement=\"top\" showClose>\n <Button label=\"顶部提示\" />\n</Tooltip>\n","blocks":[{"language":"tsx","code":"<Tooltip content=\"点击关闭按钮隐藏\" placement=\"top\" showClose>\n <Button label=\"顶部提示\" />\n</Tooltip>\n"}]}],"allowUnknownProps":false},{"name":"Tour","id":"tour","label":"Tour 漫游","category":"导航","categoryId":"navigation","kind":"component","description":"漫游引导通过高亮目标元素逐步介绍页面功能,支持步骤切换、自定义内容和目标定位。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Tour.tsx","docPath":"docs/ui/components/tour.md","doc":"# Tour 漫游\n\n漫游引导通过高亮目标元素逐步介绍页面功能,支持步骤切换、自定义内容和目标定位。\n\n```tsx\nimport { Tour } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 开始引导\n\n通过 `show` 控制引导显示,`steps` 中的 `element` 指定目标元素,`content` 指定提示内容。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<view id=\"tour-target\">\n <Button\n label=\"开始引导\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n />\n</view>\n<Tour\n show={show}\n onShowChange={setShow}\n steps={[{ element: '#tour-target', content: '点击这里开始操作' }]}\n/>\n```\n\n## 组件样式\n\n### 高亮区域与按钮文案\n\n通过 `padding` 和 `borderRadius` 调整高亮区域,通过 `finishText` 设置完成按钮文案。\n\n```tsx\n<Tour\n show={false}\n steps={[{ element: '#tour-target', content: '完成设置' }]}\n padding={12}\n borderRadius={8}\n finishText=\"知道了\"\n/>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| show | 是否显示 | `boolean` | `false` |\n| steps | 引导步骤列表 | `readonly TourStep[]` | 必填 |\n| current | 当前索引或位置 | `number` | — |\n| defaultCurrent | 非受控模式的初始索引 | `number` | `0` |\n| mask | 是否显示遮罩 | `boolean` | `true` |\n| maskColor | 遮罩颜色 | `string` | `'rgba(0,0,0,.55)'` |\n| offset | 相对目标元素的偏移 | `number` | `20` |\n| duration | 动画或显示时长,单位 ms | `number` | `300` |\n| borderRadius | 圆角半径 | `number` | `4` |\n| padding | 内边距或高亮区域留白 | `number` | `8` |\n| prevText | 上一步按钮文案 | `string` | `'上一步'` |\n| nextText | 下一步按钮文案 | `string` | `'下一步'` |\n| skipText | 跳过按钮文案 | `string` | `'跳过'` |\n| finishText | 完成按钮文案 | `string` | `'完成'` |\n| highlightStyle | 高亮区域样式 | `CSSProperties` | — |\n| clickMaskNext | 点击遮罩时是否前进到下一步 | `boolean` | `false` |\n| zIndex | 浮层层级 | `number` | `999` |\n| showTourButtons | 是否显示引导操作按钮 | `boolean` | `true` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| missingStrategy | 目标元素缺失时的处理方式 | `'skip' \\| 'stop' \\| 'hide'` | `'stop'` |\n| scrollToTarget | Await host/scroll-view positioning before native target measurement. | `(step: TourStep, index: number) => void \\| Promise<void>` | — |\n| getTargetRect | Optional scoped native measurement, e.g. a NodesRef from the caller. | `(step: TourStep, index: number) => BubbleRect \\| null \\| Promise<BubbleRect \\| null>` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onShowChange | 显示状态变化时触发 | (show: boolean) => void |\n| onCurrentChange | 对应操作发生时触发 | (current: number) => void |\n| onChange | 值发生变化时触发 | (event: { current: number }) => void |\n| onPrev | 对应操作发生时触发 | (event: TourStepEvent) => void |\n| onNext | 对应操作发生时触发 | (event: TourStepEvent) => void |\n| onFinish | 对应操作发生时触发 | (event: TourEndEvent) => void |\n| onSkip | 对应操作发生时触发 | (event: TourEndEvent) => void |\n| onError | 发生错误时触发 | (event: { message: string; element: string }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderContent | 自定义内容 | (state: TourRenderState) => ReactNode |\n| renderHighlight | 自定义区域内容 | (state: TourRenderState) => ReactNode |\n| renderPrev | 自定义区域内容 | (state: TourRenderState) => ReactNode |\n| renderNext | 自定义区域内容 | (state: TourRenderState) => ReactNode |\n| renderSkip | 自定义区域内容 | (state: TourRenderState) => ReactNode |\n| renderFinish | 自定义区域内容 | (state: TourRenderState) => ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| handlePrev | 调用实例方法 | () => void |\n| handleNext | 调用实例方法 | () => void |\n| handleSkip | 调用实例方法 | () => void |\n| handleFinish | 调用实例方法 | () => void |\n| updatePosition | 重新计算位置 | () => void |\n\n## 数据类型\n\n```tsx\nexport type TourStep = {\n element: string;\n content: string;\n padding?: number;\n offset?: number;\n placement?: 'auto' | 'top' | 'bottom' | 'left' | 'right';\n};\n\nexport type TourStepEvent = {\n prevCurrent: number;\n current: number;\n total: number;\n isElementInTop: boolean;\n};\n\nexport type TourEndEvent = { current: number; total: number };\n\nexport type TourRenderState = {\n current: number;\n total: number;\n step: TourStep;\n elementInfo: BubbleRect;\n prev: () => void;\n next: () => void;\n skip: () => void;\n finish: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[Tour 组件源码](./sources/tour/Tour.tsx.txt) · [示例源码](./sources/tour/demo.tsx.txt) · [文档源码](./sources/tour/docs.md.txt)\n","demoSource":"import { useRef, useState } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { Button, Icon, Toast, Tour, useToast } from 'daisu-ui';\nimport type { TourStep } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nconst titles = ['第一步', '第二步', '第三步', '第四步'];\nconst descriptions = ['这是引导的第一步,介绍基本功能', '这是引导的第二步,展示更多功能', '这是引导的第三步,深入功能介绍', '这是引导的最后一步,总结功能'];\nconst steps: readonly TourStep[] = [\n { element: '#demo-tour-step-0', content: '欢迎使用引导组件,这是第一步的说明' },\n { element: '#demo-tour-step-1', content: '这是第二步,展示了另一个功能点' },\n { element: '#demo-tour-step-2', content: '这是第三步,深入了解功能' },\n { element: '#demo-tour-step-3', content: '这是最后一步,感谢使用引导组件' },\n];\nexport function TourExample() {\n const [mode, setMode] = useState(''), [current, setCurrent] = useState(0);\n const scroll = useRef<NodesRef | null>(null); const toast = useToast();\n const start = (next: string) => { 'background only'; setCurrent(next === 'control' ? 2 : 0); setMode(next); };\n const scrollToTarget = async () => { 'background only'; scroll.current?.invoke({ method: 'scrollTo', params: { index: 0, offset: 0, smooth: false } }).exec(); await new Promise<void>(resolve => setTimeout(resolve, 50)); };\n const trigger = (label: string, next: string) => <view className=\"demo-tour-trigger\"><Button label={label} onTap={() => start(next)} /></view>;\n return <scroll-view ref={scroll} className=\"ui-demo-component-scroll\" scroll-orientation=\"vertical\" enable-scroll={mode === ''}>\n <view className=\"demo-tour-page\">\n <view className=\"demo-tour-targets\">{titles.map((title, i) => <view key={i} id={`demo-tour-step-${i}`} flatten={false} className=\"demo-tour-item\"><text className=\"demo-tour-title\">{title}</text><text className=\"demo-tour-description\">{descriptions[i]}</text></view>)}</view>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\">{trigger('开始引导', 'basic')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"点击蒙版继续\">{trigger('点击蒙版继续', 'click')}</ExampleBlock><ExampleBlock title=\"关闭蒙版\">{trigger('关闭蒙版', 'no-mask')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义蒙版\">{trigger('自定义蒙版', 'mask')}</ExampleBlock><ExampleBlock title=\"自定义高亮区域\">{trigger('自定义高亮区域', 'highlight')}</ExampleBlock><ExampleBlock title=\"自定义内容和按钮\">{trigger('自定义内容和按钮', 'content')}</ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"控制当前步骤\">{trigger('从第三步开始', 'control')}</ExampleBlock></DemoGroup>\n <Tour className=\"ui-demo-page demo-tour-layer\" show={mode !== ''} onShowChange={show => { 'background only'; if (!show) setMode(''); }} steps={steps} current={current} onCurrentChange={setCurrent} padding={10} mask={mode !== 'no-mask'} clickMaskNext={mode === 'click'} maskColor={mode === 'mask' ? 'rgba(255,0,0,.55)' : undefined} borderRadius={mode === 'mask' ? 15 : undefined} offset={mode === 'mask' ? 40 : undefined} rootPortal scrollToTarget={scrollToTarget}\n onFinish={() => { 'background only'; toast.success('引导完成'); }} onError={e => { 'background only'; toast.error(e.message); }}\n renderHighlight={mode === 'highlight' ? () => <view className=\"demo-tour-custom-highlight\" /> : undefined}\n renderContent={mode === 'content' ? () => <view className=\"demo-tour-custom-content\"><Icon name=\"help-circle-filled\" size={22} color=\"#1c64fd\" /><text>自定义引导内容区域</text></view> : undefined}\n renderNext={mode === 'content' ? state => <Button label=\"下一步\" size=\"mini\" onTap={state.next} /> : undefined}\n renderFinish={mode === 'content' ? state => <Button label=\"完成\" size=\"mini\" onTap={state.finish} /> : undefined} />\n <Toast {...toast.props} rootPortal />\n <view className=\"ui-demo-bottom-space\" />\n </view>\n </scroll-view>;\n}\n","props":[{"name":"show","type":"boolean","optional":true,"description":"是否显示","defaultValue":"false","values":[false,true]},{"name":"steps","type":"readonly TourStep[]","optional":false,"description":"引导步骤列表","defaultValue":"必填"},{"name":"current","type":"number","optional":true,"description":"当前索引或位置"},{"name":"defaultCurrent","type":"number","optional":true,"description":"非受控模式的初始索引","defaultValue":"0"},{"name":"mask","type":"boolean","optional":true,"description":"是否显示遮罩","defaultValue":"true","values":[false,true]},{"name":"maskColor","type":"string","optional":true,"description":"遮罩颜色","defaultValue":"'rgba(0,0,0,.55)'"},{"name":"offset","type":"number","optional":true,"description":"相对目标元素的偏移","defaultValue":"20"},{"name":"duration","type":"number","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"300"},{"name":"borderRadius","type":"number","optional":true,"description":"圆角半径","defaultValue":"4"},{"name":"padding","type":"number","optional":true,"description":"内边距或高亮区域留白","defaultValue":"8"},{"name":"prevText","type":"string","optional":true,"description":"上一步按钮文案","defaultValue":"'上一步'"},{"name":"nextText","type":"string","optional":true,"description":"下一步按钮文案","defaultValue":"'下一步'"},{"name":"skipText","type":"string","optional":true,"description":"跳过按钮文案","defaultValue":"'跳过'"},{"name":"finishText","type":"string","optional":true,"description":"完成按钮文案","defaultValue":"'完成'"},{"name":"highlightStyle","type":"CSSProperties","optional":true,"description":"高亮区域样式"},{"name":"clickMaskNext","type":"boolean","optional":true,"description":"点击遮罩时是否前进到下一步","defaultValue":"false","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"999"},{"name":"showTourButtons","type":"boolean","optional":true,"description":"是否显示引导操作按钮","defaultValue":"true","values":[false,true]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"missingStrategy","type":"'skip' | 'stop' | 'hide'","optional":true,"description":"目标元素缺失时的处理方式","defaultValue":"'stop'","values":["stop","skip","hide"]},{"name":"scrollToTarget","type":"(step: TourStep, index: number) => void | Promise<void>","optional":true,"description":"Await host/scroll-view positioning before native target measurement."},{"name":"getTargetRect","type":"(step: TourStep, index: number) => BubbleRect | null | Promise<BubbleRect | null>","optional":true,"description":"Optional scoped native measurement, e.g. a NodesRef from the caller."},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[{"name":"onShowChange","type":"(show: boolean) => void","optional":true,"description":"显示状态变化时触发"},{"name":"onCurrentChange","type":"(current: number) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onChange","type":"(event: { current: number }) => void","optional":true,"description":"值发生变化时触发"},{"name":"onPrev","type":"(event: TourStepEvent) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onNext","type":"(event: TourStepEvent) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onFinish","type":"(event: TourEndEvent) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onSkip","type":"(event: TourEndEvent) => void","optional":true,"description":"对应操作发生时触发"},{"name":"onError","type":"(event: { message: string; element: string }) => void","optional":true,"description":"发生错误时触发"}],"slots":[{"name":"renderContent","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义内容"},{"name":"renderHighlight","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderPrev","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderNext","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderSkip","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义区域内容"},{"name":"renderFinish","type":"(state: TourRenderState) => ReactNode","optional":true,"description":"自定义区域内容"}],"methods":[{"name":"handlePrev","description":"调用实例方法","type":"() => void"},{"name":"handleNext","description":"调用实例方法","type":"() => void"},{"name":"handleSkip","description":"调用实例方法","type":"() => void"},{"name":"handleFinish","description":"调用实例方法","type":"() => void"},{"name":"updatePosition","description":"重新计算位置","type":"() => void"}],"cssVars":[{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","开始引导"],"title":"开始引导","section":"基础用法","description":"通过 `show` 控制引导显示,`steps` 中的 `element` 指定目标元素,`content` 指定提示内容。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<view id=\"tour-target\">\n <Button\n label=\"开始引导\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n />\n</view>\n<Tour\n show={show}\n onShowChange={setShow}\n steps={[{ element: '#tour-target', content: '点击这里开始操作' }]}\n/>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(false);\n\n<view id=\"tour-target\">\n <Button\n label=\"开始引导\"\n onTap={() => {\n 'background only';\n setShow(true);\n }}\n />\n</view>\n<Tour\n show={show}\n onShowChange={setShow}\n steps={[{ element: '#tour-target', content: '点击这里开始操作' }]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","高亮区域与按钮文案"],"title":"高亮区域与按钮文案","section":"组件样式","description":"通过 `padding` 和 `borderRadius` 调整高亮区域,通过 `finishText` 设置完成按钮文案。","language":"tsx","code":"<Tour\n show={false}\n steps={[{ element: '#tour-target', content: '完成设置' }]}\n padding={12}\n borderRadius={8}\n finishText=\"知道了\"\n/>\n","blocks":[{"language":"tsx","code":"<Tour\n show={false}\n steps={[{ element: '#tour-target', content: '完成设置' }]}\n padding={12}\n borderRadius={8}\n finishText=\"知道了\"\n/>\n"}]}],"allowUnknownProps":false},{"name":"Transition","id":"transition","label":"Transition 动画","category":"基础","categoryId":"basic","kind":"component","description":"动画组件通过 show 控制内容的进入与离开,支持淡入、缩放、滑动和自定义过渡类名。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Transition.tsx","docPath":"docs/ui/components/transition.md","doc":"# Transition 动画\n\n动画组件通过 show 控制内容的进入与离开,支持淡入、缩放、滑动和自定义过渡类名。\n\n```tsx\nimport { Transition } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 淡入淡出\n\n通过 `show` 控制显示状态,设置 `name=\"fade\"` 使用淡入淡出。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(true);\n\n<Button\n label=\"切换\"\n onTap={() => {\n 'background only';\n setShow(!show);\n }}\n/>\n<Transition show={show} name=\"fade\">\n <text>动画内容</text>\n</Transition>\n```\n\n## 组件变体\n\n### 组合动画\n\n`name` 支持动画名称数组,可组合淡入与缩放;通过 `duration` 设置时长。\n\n```tsx\n<Transition show name={['fade', 'zoom-in']} duration={300}>\n <text>淡入并缩放</text>\n</Transition>\n```\n\n## 生命周期\n\n### 动画结束回调\n\n通过 `onAfterEnter` 处理进入动画结束后的操作。\n\n```tsx\n<Transition\n show\n name=\"slide-up\"\n onAfterEnter={() => {\n 'background only';\n console.log('进入完成');\n }}\n>\n <text>内容</text>\n</Transition>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| show | 是否显示 | `boolean` | 必填 |\n| name | 名称或标识 | `TransitionName \\| readonly TransitionName[]` | `'fade'` |\n| duration | 动画或显示时长,单位 ms | `number \\| boolean \\| { enter: number; leave: number }` | `300` |\n| lazyRender | 首次展示时再挂载内容 | `boolean` | `false` |\n| destroy | 离开后是否卸载内容 | `boolean` | `true` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n| interactiveDuringLeave | Keep a modal's hit target until its leave animation has finished. | `boolean` | `false` |\n| enterClassName | 进入起始状态类名 | `string` | `''` |\n| enterActiveClassName | 进入过程类名 | `string` | `''` |\n| enterToClassName | 进入结束状态类名 | `string` | `''` |\n| leaveClassName | 离开起始状态类名 | `string` | `''` |\n| leaveActiveClassName | 离开过程类名 | `string` | `''` |\n| leaveToClassName | 离开结束状态类名 | `string` | `''` |\n| children | 自定义内容 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onBeforeEnter | 进入动画开始前触发 | () => void |\n| onEnter | 进入动画开始时触发 | () => void |\n| onAfterEnter | 进入动画完成时触发 | () => void |\n| onBeforeLeave | 离开动画开始前触发 | () => void |\n| onLeave | 离开动画开始时触发 | () => void |\n| onAfterLeave | 离开动画完成时触发 | () => void |\n| onTap | 点击时触发 | () => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type TransitionName =\n | 'fade'\n | 'fade-up'\n | 'fade-down'\n | 'fade-left'\n | 'fade-right'\n | 'slide-up'\n | 'slide-down'\n | 'slide-left'\n | 'slide-right'\n | 'zoom-in'\n | 'zoom-out';\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Transition 组件源码](./sources/transition/Transition.tsx.txt) · [示例源码](./sources/transition/demo.tsx.txt) · [文档源码](./sources/transition/docs.md.txt)\n","demoSource":"import { useEffect, useRef, useState } from '@lynx-js/react';\nimport { Button, Transition } from 'daisu-ui';\nimport type { TransitionName } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nexport function TransitionExample() {\n const [show, setShow] = useState(false);\n const [name, setName] = useState<TransitionName>('fade');\n const [customShow, setCustomShow] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout>>();\n const customTimer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => { clearTimeout(timer.current); clearTimeout(customTimer.current); }, []);\n const run = (next: TransitionName) => { 'background only'; clearTimeout(timer.current); setName(next); setShow(true); timer.current = setTimeout(() => setShow(false), 500); };\n const runCustom = () => { 'background only'; clearTimeout(customTimer.current); setCustomShow(true); customTimer.current = setTimeout(() => setCustomShow(false), 1200); };\n const buttons = (names: TransitionName[]) => <view className=\"demo-transition-buttons\">{names.map(item => <Button key={item} className=\"demo-transition-trigger\" label={item} onTap={() => { 'background only'; run(item); }} />)}</view>;\n return <view className=\"demo-transition-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"Fade 动画\">{buttons(['fade', 'fade-up', 'fade-down', 'fade-left', 'fade-right'])}</ExampleBlock>\n <ExampleBlock title=\"Slide 动画\">{buttons(['slide-up', 'slide-down', 'slide-left', 'slide-right'])}</ExampleBlock>\n <ExampleBlock title=\"Zoom 动画\">{buttons(['zoom-in', 'zoom-out'])}</ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"自定义动画\"><view className=\"demo-transition-buttons\"><Button className=\"demo-transition-trigger\" label=\"custom\" onTap={runCustom} /></view></ExampleBlock></DemoGroup>\n <Transition show={show} name={name} className=\"demo-transition-block\" />\n <Transition show={customShow} name={[]} duration={{ enter: 700, leave: 1000 }} className=\"demo-transition-block demo-transition-custom\" enterClassName=\"demo-transition-custom-enter\" enterActiveClassName=\"demo-transition-custom-active\" leaveActiveClassName=\"demo-transition-custom-active\" leaveToClassName=\"demo-transition-custom-leave\" />\n </view>;\n}\n","props":[{"name":"show","type":"boolean","optional":false,"description":"是否显示","defaultValue":"必填","values":[false,true]},{"name":"name","type":"TransitionName | readonly TransitionName[]","optional":true,"description":"名称或标识","defaultValue":"'fade'"},{"name":"duration","type":"number | boolean | { enter: number; leave: number }","optional":true,"description":"动画或显示时长,单位 ms","defaultValue":"300"},{"name":"lazyRender","type":"boolean","optional":true,"description":"首次展示时再挂载内容","defaultValue":"false","values":[false,true]},{"name":"destroy","type":"boolean","optional":true,"description":"离开后是否卸载内容","defaultValue":"true","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"},{"name":"interactiveDuringLeave","type":"boolean","optional":true,"description":"Keep a modal's hit target until its leave animation has finished.","defaultValue":"false","values":[false,true]},{"name":"enterClassName","type":"string","optional":true,"description":"进入起始状态类名","defaultValue":"''"},{"name":"enterActiveClassName","type":"string","optional":true,"description":"进入过程类名","defaultValue":"''"},{"name":"enterToClassName","type":"string","optional":true,"description":"进入结束状态类名","defaultValue":"''"},{"name":"leaveClassName","type":"string","optional":true,"description":"离开起始状态类名","defaultValue":"''"},{"name":"leaveActiveClassName","type":"string","optional":true,"description":"离开过程类名","defaultValue":"''"},{"name":"leaveToClassName","type":"string","optional":true,"description":"离开结束状态类名","defaultValue":"''"}],"events":[{"name":"onBeforeEnter","type":"() => void","optional":true,"description":"进入动画开始前触发"},{"name":"onEnter","type":"() => void","optional":true,"description":"进入动画开始时触发"},{"name":"onAfterEnter","type":"() => void","optional":true,"description":"进入动画完成时触发"},{"name":"onBeforeLeave","type":"() => void","optional":true,"description":"离开动画开始前触发"},{"name":"onLeave","type":"() => void","optional":true,"description":"离开动画开始时触发"},{"name":"onAfterLeave","type":"() => void","optional":true,"description":"离开动画完成时触发"},{"name":"onTap","type":"() => void","optional":true,"description":"点击时触发"}],"slots":[{"name":"children","type":"ReactNode","optional":true,"description":"自定义内容"}],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","淡入淡出"],"title":"淡入淡出","section":"组件类型","description":"通过 `show` 控制显示状态,设置 `name=\"fade\"` 使用淡入淡出。","language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(true);\n\n<Button\n label=\"切换\"\n onTap={() => {\n 'background only';\n setShow(!show);\n }}\n/>\n<Transition show={show} name=\"fade\">\n <text>动画内容</text>\n</Transition>\n","blocks":[{"language":"tsx","code":"import { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [show, setShow] = useState(true);\n\n<Button\n label=\"切换\"\n onTap={() => {\n 'background only';\n setShow(!show);\n }}\n/>\n<Transition show={show} name=\"fade\">\n <text>动画内容</text>\n</Transition>\n"}]},{"name":"demo-2","aliases":["demo-2","组合动画"],"title":"组合动画","section":"组件变体","description":"`name` 支持动画名称数组,可组合淡入与缩放;通过 `duration` 设置时长。","language":"tsx","code":"<Transition show name={['fade', 'zoom-in']} duration={300}>\n <text>淡入并缩放</text>\n</Transition>\n","blocks":[{"language":"tsx","code":"<Transition show name={['fade', 'zoom-in']} duration={300}>\n <text>淡入并缩放</text>\n</Transition>\n"}]},{"name":"demo-3","aliases":["demo-3","动画结束回调"],"title":"动画结束回调","section":"生命周期","description":"通过 `onAfterEnter` 处理进入动画结束后的操作。","language":"tsx","code":"<Transition\n show\n name=\"slide-up\"\n onAfterEnter={() => {\n 'background only';\n console.log('进入完成');\n }}\n>\n <text>内容</text>\n</Transition>\n","blocks":[{"language":"tsx","code":"<Transition\n show\n name=\"slide-up\"\n onAfterEnter={() => {\n 'background only';\n console.log('进入完成');\n }}\n>\n <text>内容</text>\n</Transition>\n"}]}],"allowUnknownProps":false},{"name":"Upload","id":"upload","label":"Upload 上传","category":"录入","categoryId":"form","kind":"component","description":"上传组件管理文件列表、上传进度、预览与删除。选取和上传过程由应用提供的适配器完成。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Upload.tsx","docPath":"docs/ui/components/upload.md","doc":"# Upload 上传\n\n上传组件管理文件列表、上传进度、预览与删除。选取和上传过程由应用提供的适配器完成。\n\n```tsx\nimport { Upload } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 展示文件\n\n通过 `fileList` 展示文件,每项的 `url` 为文件地址,`status` 表示上传状态。\n\n```tsx\n<Upload\n fileList={[{ url: 'https://example.com/photo.jpg', status: 'success' }]}\n/>\n```\n\n## 组件状态\n\n### 禁用与数量限制\n\n设置 `disabled` 禁止操作,通过 `limit` 限制文件数量;实际文件选择和上传通过 `adapter` 接入。\n\n```tsx\n<Upload disabled />\n<Upload limit={3} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| fileList | 受控列表,回调 `{ fileList }` 后由调用方回填 | `readonly UploadFile[]` | — |\n| adapter | `chooseAndUpload(onProgress): Promise<UploadFile \\| null>`,null 表示用户取消;可选 `preview(files, index)` | `UploadAdapter` | — |\n| disabled | 禁止增删;readonly 隐藏上传入口。普通图片仍可预览,disabled 时覆盖上传不可操作 | `boolean` | — |\n| readonly | 禁止增删;readonly 隐藏上传入口。普通图片仍可预览,disabled 时覆盖上传不可操作 | `boolean` | `false` |\n| limit | 0 不限;到达上限隐藏入口,入口显示全角 `(当前数/上限)` | `number` | `0` |\n| size | 图片和默认入口边长;imageMode 支持 aspectFit / aspectFill / scaleToFill / center | `number` | `88` |\n| deletable | 非 loading、非禁用、非只读时显示删除按钮 | `boolean` | `true` |\n| showLimitNum | 0 不限;到达上限隐藏入口,入口显示全角 `(当前数/上限)` | `boolean` | `true` |\n| reupload | 点击已有图片时重新选择并替换这一项,其余项保留;仍允许在上限内追加 | `boolean` | `false` |\n| previewFullImage | false 时只触发预览事件,不调用适配器 | `boolean` | `true` |\n| imageMode | 图片和默认入口边长;imageMode 支持 aspectFit / aspectFill / scaleToFill / center | `'aspectFit' \\| 'aspectFill' \\| 'scaleToFill' \\| 'center'` | `'aspectFill'` |\n| uploadIcon | 默认入口图标和可选文字 | `string` | `'camera-fill'` |\n| uploadText | 默认入口图标和可选文字 | `string` | — |\n| loadingType | 图片 loading 遮罩参数;选择上传期间入口显示进度 | `LoadingProps['type']` | `'circular'` |\n| loadingSize | 图片 loading 遮罩参数;选择上传期间入口显示进度 | `number` | `24` |\n| loadingColor | 图片 loading 遮罩参数;选择上传期间入口显示进度 | `string` | `'#fff'` |\n| beforeChoose | `({ fileList, reuploadIndex? }) => boolean \\| Promise<boolean>`;选择前拦截 | `(event: { fileList: readonly UploadFile[]; reuploadIndex?: number }) => boolean \\| Promise<boolean>` | — |\n| beforePreview | `(file, index) => boolean \\| Promise<boolean>`;false 阻止操作,异常通过 onFail 报告 | `(file: UploadFile, index: number) => boolean \\| Promise<boolean>` | — |\n| beforeRemove | `(file, index) => boolean \\| Promise<boolean>`;false 阻止操作,异常通过 onFail 报告 | `(file: UploadFile, index: number) => boolean \\| Promise<boolean>` | — |\n| className | 根节点、入口、预览项及根样式 | `string` | `''` |\n| evokeClassName | 根节点、入口、预览项及根样式 | `string` | `''` |\n| previewClassName | 根节点、入口、预览项及根样式 | `string` | `''` |\n| style | 根节点、入口、预览项及根样式 | `CSSProperties` | — |\n| children | 自定义上传触发器,保持自身尺寸,不套 88px 的默认入口 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 受控列表,回调 `{ fileList }` 后由调用方回填 | (event: { fileList: UploadFile[] }) => void |\n| onSuccess | 参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名 | (file: UploadFile) => void |\n| onFail | 参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名 | (error: Error) => void |\n| onProgress | 参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名 | (progress: number) => void |\n| onPreview | `{ file, index }`;移除成功后触发 onRemove | (event: { file: UploadFile; index: number }) => void |\n| onRemove | `{ file, index }`;移除成功后触发 onRemove | (event: { file: UploadFile; index: number }) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderPreviewCover | `({ file, index }) => ReactNode`,用于图片上的自定义覆盖内容 | (event: { file: UploadFile; index: number }) => ReactNode |\n| children | 自定义上传触发器,保持自身尺寸,不套 88px 的默认入口 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type UploadFile = {\n url: string;\n name?: string;\n path?: string;\n status?: 'success' | 'loading' | 'fail';\n message?: string;\n percent?: number;\n};\n\nexport type UploadAdapter = {\n chooseAndUpload: (\n onProgress: (progress: number) => void,\n ) => Promise<UploadFile | null>;\n preview?: (\n files: readonly UploadFile[],\n index: number,\n ) => void | Promise<void>;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Upload 组件源码](./sources/upload/Upload.tsx.txt) · [示例源码](./sources/upload/demo.tsx.txt) · [文档源码](./sources/upload/docs.md.txt)\n","demoSource":"import { useMemo, useState } from '@lynx-js/react';\nimport type { HostClient } from '../../../lib/host.js';\nimport { createHostUploadAdapter } from '../../../lib/uiUpload.js';\nimport { Button, Dialog, Toast, Upload, useDialog, useToast } from 'daisu-ui';\nimport type { UploadAdapter, UploadFile, UploadProps } from 'daisu-ui';\nimport panda from '../../../assets/demo-panda.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\n\nfunction UploadCase({ adapter, initial = [], ...props }: UploadProps & { initial?: UploadFile[] }) {\n const [files, setFiles] = useState<UploadFile[]>(initial);\n return <Upload imageMode=\"aspectFit\" {...props} fileList={files} adapter={adapter} onChange={({ fileList }) => { 'background only'; setFiles(fileList); }} />;\n}\nexport function UploadExample({ host }: { host?: HostClient | null }) {\n const dialog = useDialog(), toast = useToast(), [status, setStatus] = useState('');\n const adapter = useMemo(() => host ? createHostUploadAdapter(host) : undefined, [host]);\n const customAdapter = useMemo<UploadAdapter | undefined>(() => adapter ? {\n async chooseAndUpload(progress) { 'background only'; const file = await adapter.chooseAndUpload(value => progress(value)); return file; },\n preview: adapter.preview,\n } : undefined, [adapter]);\n const confirm = async (message: string, cancelMessage: string) => {\n 'background only';\n try { await dialog.confirm({ title: '提示', msg: message }); return true; }\n catch { toast.info(cancelMessage); return false; }\n };\n const common = { adapter, onFail: (error: Error) => { 'background only'; toast.error(error.message); } };\n return <view className=\"demo-upload-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><UploadCase {...common} initial={[{ url: panda }]} imageMode=\"aspectFill\" /></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"上传状态钩子\"><UploadCase {...common} onProgress={value => { 'background only'; setStatus(`上传中:${Math.round(value)}%`); }} onSuccess={file => { 'background only'; setStatus(`上传成功:${file.name || file.url}`); }} onFail={error => { 'background only'; setStatus(`上传失败:${error.message}`); }} />{status ? <text className=\"demo-upload-status\">{status}</text> : null}</ExampleBlock>\n <ExampleBlock title=\"禁用\"><UploadCase {...common} disabled /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件变体\">\n <ExampleBlock title=\"最大上传数限制\"><UploadCase {...common} limit={3} /></ExampleBlock>\n <ExampleBlock title=\"覆盖上传\"><UploadCase {...common} initial={[{ url: panda }]} reupload imageMode=\"aspectFill\" /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"自定义唤起上传样式并限制上传5张\"><UploadCase {...common} limit={5}><Button label=\"自定义唤起样式\" /></UploadCase></ExampleBlock>\n <ExampleBlock title=\"自定义预览样式\"><UploadCase {...common} initial={[{ url: panda, name: 'panda' }]} imageMode=\"aspectFill\" renderPreviewCover={({ file, index }) => <text className=\"demo-upload-preview-cover\">{file.name || `文件${index}`}</text>} /></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"特殊样式\">\n <ExampleBlock title=\"拦截预览图片操作\"><UploadCase {...common} beforePreview={() => { 'background only'; return confirm('是否预览图片', '取消预览操作'); }} /></ExampleBlock>\n <ExampleBlock title=\"移除图片前置处理\"><UploadCase {...common} beforeRemove={() => { 'background only'; return confirm('是否删除', '取消删除操作'); }} onRemove={() => { 'background only'; toast.success('删除成功'); }} /></ExampleBlock>\n <ExampleBlock title=\"选择文件前置处理\"><UploadCase {...common} beforeChoose={() => { 'background only'; return confirm('是否选择', '取消选择操作'); }} /></ExampleBlock>\n <ExampleBlock title=\"自定义上传方法\"><UploadCase {...common} adapter={customAdapter} /></ExampleBlock>\n </DemoGroup>\n <text className=\"demo-upload-host-note\">图片上传需要有效登录会话。当前宿主支持图片单选。</text>\n <Dialog {...dialog.props} /><Toast {...toast.props} />\n </view>;\n}\n","props":[{"name":"fileList","type":"readonly UploadFile[]","optional":true,"description":"受控列表,回调 { fileList } 后由调用方回填","defaultValue":"emptyFiles"},{"name":"adapter","type":"UploadAdapter","optional":true,"description":"chooseAndUpload(onProgress): Promise<UploadFile | null>,null 表示用户取消;可选 preview(files, index)"},{"name":"disabled","type":"boolean","optional":true,"description":"禁止增删;readonly 隐藏上传入口。普通图片仍可预览,disabled 时覆盖上传不可操作","values":[false,true]},{"name":"readonly","type":"boolean","optional":true,"description":"禁止增删;readonly 隐藏上传入口。普通图片仍可预览,disabled 时覆盖上传不可操作","defaultValue":"false","values":[false,true]},{"name":"limit","type":"number","optional":true,"description":"0 不限;到达上限隐藏入口,入口显示全角 (当前数/上限)","defaultValue":"0"},{"name":"size","type":"number","optional":true,"description":"图片和默认入口边长;imageMode 支持 aspectFit / aspectFill / scaleToFill / center","defaultValue":"88"},{"name":"deletable","type":"boolean","optional":true,"description":"非 loading、非禁用、非只读时显示删除按钮","defaultValue":"true","values":[false,true]},{"name":"showLimitNum","type":"boolean","optional":true,"description":"0 不限;到达上限隐藏入口,入口显示全角 (当前数/上限)","defaultValue":"true","values":[false,true]},{"name":"reupload","type":"boolean","optional":true,"description":"点击已有图片时重新选择并替换这一项,其余项保留;仍允许在上限内追加","defaultValue":"false","values":[false,true]},{"name":"previewFullImage","type":"boolean","optional":true,"description":"false 时只触发预览事件,不调用适配器","defaultValue":"true","values":[false,true]},{"name":"imageMode","type":"'aspectFit' | 'aspectFill' | 'scaleToFill' | 'center'","optional":true,"description":"图片和默认入口边长;imageMode 支持 aspectFit / aspectFill / scaleToFill / center","defaultValue":"'aspectFill'","values":["center","scaleToFill","aspectFit","aspectFill"]},{"name":"uploadIcon","type":"string","optional":true,"description":"默认入口图标和可选文字","defaultValue":"'camera-fill'"},{"name":"uploadText","type":"string","optional":true,"description":"默认入口图标和可选文字"},{"name":"loadingType","type":"LoadingProps['type']","optional":true,"description":"图片 loading 遮罩参数;选择上传期间入口显示进度","defaultValue":"'circular'","values":["circular","spinner","dots","wave"]},{"name":"loadingSize","type":"number","optional":true,"description":"图片 loading 遮罩参数;选择上传期间入口显示进度","defaultValue":"24"},{"name":"loadingColor","type":"string","optional":true,"description":"图片 loading 遮罩参数;选择上传期间入口显示进度","defaultValue":"'#fff'"},{"name":"beforeChoose","type":"(event: { fileList: readonly UploadFile[]; reuploadIndex?: number }) => boolean | Promise<boolean>","optional":true,"description":"({ fileList, reuploadIndex? }) => boolean | Promise<boolean>;选择前拦截"},{"name":"beforePreview","type":"(file: UploadFile, index: number) => boolean | Promise<boolean>","optional":true,"description":"(file, index) => boolean | Promise<boolean>;false 阻止操作,异常通过 onFail 报告"},{"name":"beforeRemove","type":"(file: UploadFile, index: number) => boolean | Promise<boolean>","optional":true,"description":"(file, index) => boolean | Promise<boolean>;false 阻止操作,异常通过 onFail 报告"},{"name":"className","type":"string","optional":true,"description":"根节点、入口、预览项及根样式","defaultValue":"''"},{"name":"evokeClassName","type":"string","optional":true,"description":"根节点、入口、预览项及根样式","defaultValue":"''"},{"name":"previewClassName","type":"string","optional":true,"description":"根节点、入口、预览项及根样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点、入口、预览项及根样式"}],"events":[{"name":"onChange","type":"(event: { fileList: UploadFile[] }) => void","optional":true,"description":"受控列表,回调 { fileList } 后由调用方回填"},{"name":"onSuccess","type":"(file: UploadFile) => void","optional":true,"description":"参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名"},{"name":"onFail","type":"(error: Error) => void","optional":true,"description":"参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名"},{"name":"onProgress","type":"(progress: number) => void","optional":true,"description":"参数分别为 UploadFile / Error / 0–100 的有限数字;保持原有事件签名"},{"name":"onPreview","type":"(event: { file: UploadFile; index: number }) => void","optional":true,"description":"{ file, index };移除成功后触发 onRemove"},{"name":"onRemove","type":"(event: { file: UploadFile; index: number }) => void","optional":true,"description":"{ file, index };移除成功后触发 onRemove"}],"slots":[{"name":"renderPreviewCover","type":"(event: { file: UploadFile; index: number }) => ReactNode","optional":true,"description":"({ file, index }) => ReactNode,用于图片上的自定义覆盖内容"},{"name":"children","type":"ReactNode","optional":true,"description":"自定义上传触发器,保持自身尺寸,不套 88px 的默认入口"}],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","展示文件"],"title":"展示文件","section":"组件类型","description":"通过 `fileList` 展示文件,每项的 `url` 为文件地址,`status` 表示上传状态。","language":"tsx","code":"<Upload\n fileList={[{ url: 'https://example.com/photo.jpg', status: 'success' }]}\n/>\n","blocks":[{"language":"tsx","code":"<Upload\n fileList={[{ url: 'https://example.com/photo.jpg', status: 'success' }]}\n/>\n"}]},{"name":"demo-2","aliases":["demo-2","禁用与数量限制"],"title":"禁用与数量限制","section":"组件状态","description":"设置 `disabled` 禁止操作,通过 `limit` 限制文件数量;实际文件选择和上传通过 `adapter` 接入。","language":"tsx","code":"<Upload disabled />\n<Upload limit={3} />\n","blocks":[{"language":"tsx","code":"<Upload disabled />\n<Upload limit={3} />\n"}]}],"allowUnknownProps":false},{"name":"useConfigProvider","id":"config-provider","label":"ConfigProvider 全局配置","category":"基础","categoryId":"basic","kind":"hook","description":"全局配置用于统一组件的明暗主题、颜色变量和默认属性,也可以在局部嵌套覆盖。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/configContext.ts","docPath":"docs/ui/components/config-provider.md","doc":"# ConfigProvider 全局配置\n\n全局配置用于统一组件的明暗主题、颜色变量和默认属性,也可以在局部嵌套覆盖。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n```\n\n## 主题模式\n\n### 明暗切换\n\n通过 `theme` 在 `light` 与 `dark` 之间切换,内部组件跟随当前主题。\n\n```tsx\nimport { useState } from '@lynx-js/react';\n\nimport { Button } from 'daisu-ui';\n\nconst [dark, setDark] = useState(false);\n\n<ConfigProvider theme={dark ? 'dark' : 'light'}>\n <Button\n label=\"切换主题\"\n onTap={() => {\n 'background only';\n setDark(!dark);\n }}\n />\n</ConfigProvider>\n```\n\n## 组件样式\n\n### 颜色与组件默认值\n\n通过 `themeVars` 覆盖主题变量,通过 `button` 设置按钮的默认属性。\n\n```tsx\n<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| theme | 外观主题 | `ConfigProviderTheme` | — |\n| themeVars | 主题变量覆盖值 | `ConfigProviderThemeVars` | — |\n| button | 按钮默认属性 | `ConfigButtonDefaults` | — |\n| tag | 标签默认属性 | `ConfigTagDefaults` | — |\n| children | 自定义内容 | `ReactNode` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ConfigProviderTheme = 'light' | 'dark';\n\nexport type ConfigProviderThemeVars = Partial<\n Record<\n | 'primary'\n | 'onPrimary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'info'\n | 'canvas'\n | 'surface'\n | 'surfaceMuted'\n | 'text'\n | 'textMuted'\n | 'line'\n | 'colorTheme'\n | 'buttonPrimaryBg'\n | 'buttonPrimaryBgColor'\n | 'buttonPrimaryColor'\n | 'buttonHeight'\n | 'buttonRadius'\n | 'buttonFontSize'\n | 'cellTitleColor',\n string | number\n >\n> & { [key: `--cso-ui-${string}`]: string | number | undefined };\n\nexport type ConfigButtonDefaults = Pick<\n ButtonProps,\n 'size' | 'tone' | 'round'\n> & { variant?: ButtonProps['variant'] | 'base'; type?: ButtonProps['tone'] };\n\nexport type ConfigTagDefaults = Pick<TagProps, 'size' | 'variant' | 'round'>;\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-avatar-bg` | 共享主题 |\n| `--cso-ui-avatar-collapse-bg` | 共享主题 |\n| `--cso-ui-avatar-collapse-color` | 共享主题 |\n| `--cso-ui-avatar-text` | 共享主题 |\n| `--cso-ui-dark-display` | 共享主题 |\n| `--cso-ui-disabled-text` | 共享主题 |\n| `--cso-ui-light-display` | 共享主题 |\n| `--cso-ui-picker-fade-bottom` | 共享主题 |\n| `--cso-ui-picker-fade-top` | 共享主题 |\n| `--cso-ui-surface-muted` | 共享主题 |\n| `--cso-ui-tag-default-color` | 共享主题 |\n| `--cso-ui-tag-light-cyan-bg` | 共享主题 |\n| `--cso-ui-tag-light-danger-bg` | 共享主题 |\n| `--cso-ui-tag-light-default-bg` | 共享主题 |\n| `--cso-ui-tag-light-lightblue-bg` | 共享主题 |\n| `--cso-ui-tag-light-pink-bg` | 共享主题 |\n| `--cso-ui-tag-light-primary-bg` | 共享主题 |\n| `--cso-ui-tag-light-purple-bg` | 共享主题 |\n| `--cso-ui-tag-light-success-bg` | 共享主题 |\n| `--cso-ui-tag-light-volcano-bg` | 共享主题 |\n| `--cso-ui-tag-light-warning-bg` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-auxiliary` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[ConfigProvider 组件源码](./sources/config-provider/ConfigProvider.tsx.txt) · [示例源码](./sources/config-provider/demo.tsx.txt) · [文档源码](./sources/config-provider/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, ConfigProvider, Popup, Radio, RadioGroup, Switch, Tag } from 'daisu-ui';\nimport type { ConfigButtonDefaults, ConfigTagDefaults } from 'daisu-ui';\nimport type { HostClient } from '../../../lib/host.js';\nimport { ComplexFormExample } from './form-complex.js';\nimport { DemoGroup } from './shared.js';\n\nconst options = {\n buttonSize:['unset','mini','small','medium','large'], buttonVariant:['unset','base','plain','dashed','soft','text'], buttonType:['unset','primary','success','info','warning','danger'],\n tagSize:['unset','small','medium','large','extra-large','default'], tagVariant:['unset','light','dark','plain','dashed','text'],\n} as const;\nexport function ConfigProviderExample({ host }: { host?: HostClient | null }) {\n const [settings,setSettings] = useState<Record<keyof typeof options,string>>({buttonSize:'unset',buttonVariant:'unset',buttonType:'unset',tagSize:'unset',tagVariant:'unset'});\n const [buttonRound,setButtonRound] = useState(false), [tagRound,setTagRound] = useState(false), [show,setShow] = useState(false);\n const button: ConfigButtonDefaults = { ...(settings.buttonSize==='unset'?{}:{size:settings.buttonSize as ConfigButtonDefaults['size']}), ...(settings.buttonVariant==='unset'?{}:{variant:settings.buttonVariant as ConfigButtonDefaults['variant']}), ...(settings.buttonType==='unset'?{}:{type:settings.buttonType as ConfigButtonDefaults['type']}), ...(buttonRound?{round:true}:{}) };\n const tag: ConfigTagDefaults = { ...(settings.tagSize==='unset'?{}:{size:settings.tagSize as ConfigTagDefaults['size']}), ...(settings.tagVariant==='unset'?{}:{variant:settings.tagVariant as ConfigTagDefaults['variant']}), ...(tagRound?{round:true}:{}) };\n const config = { ...(Object.keys(button).length?{button}:{}), ...(Object.keys(tag).length?{tag}:{}) };\n const control = (name: keyof typeof options, title: string) => <Cell key={name} title={title} titleWidth=\"18.666667vw\" center>\n <RadioGroup<string> type=\"button\" direction=\"horizontal\" className=\"demo-config-choices\" value={settings[name]} onChange={value => { 'background only'; if(value) setSettings(previous=>({...previous,[name]:value})); }}>\n {options[name].map(value=><Radio key={value} value={value}>{value}</Radio>)}\n </RadioGroup>\n </Cell>;\n return <view className=\"demo-config-provider-page\">\n <DemoGroup title=\"全局配置 Playground\">\n <CellGroup title=\"控制面板\" border>\n {control('buttonSize','Button.size')}{control('buttonVariant','Button.variant')}{control('buttonType','Button.type')}\n <Cell title=\"Button.round\" titleWidth=\"18.666667vw\" center><Switch className=\"demo-config-switch\" size={20} value={buttonRound} onChange={({value})=>setButtonRound(!!value)} /></Cell>\n {control('tagSize','Tag.size')}{control('tagVariant','Tag.variant')}\n <Cell title=\"Tag.round\" titleWidth=\"18.666667vw\" center><Switch className=\"demo-config-switch\" size={20} value={tagRound} onChange={({value})=>setTagRound(!!value)} /></Cell>\n </CellGroup>\n <ConfigProvider {...config}>\n <CellGroup title=\"实时预览\" border>\n <Cell title=\"按钮\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"primary\"/><Button tone=\"success\" label=\"success\"/><Button tone=\"info\" label=\"info\"/></view></Cell>\n <Cell title=\"标签\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Tag>default</Tag><Tag type=\"primary\">primary</Tag><Tag type=\"success\">success</Tag></view></Cell>\n <Cell title=\"root-portal 穿透测试\" titleWidth=\"18.666667vw\" center><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"打开 popup\" onTap={()=>setShow(true)}/></view></Cell>\n </CellGroup>\n <Popup show={show} onChange={setShow} position=\"bottom\" rootPortal closable className=\"ui-demo-page\"><view className=\"demo-config-popup-content\"><text className=\"demo-config-preview-label\">popup 内</text><view className=\"demo-config-preview-items\"><Button tone=\"primary\" label=\"button\"/><Tag type=\"primary\">tag</Tag></view><Button tone=\"info\" variant=\"plain\" block label=\"关闭\" onTap={()=>setShow(false)}/></view></Popup>\n </ConfigProvider>\n <CellGroup title=\"当前生效配置\" border><text className=\"demo-config-json\">{JSON.stringify(config,null,2)}</text></CellGroup>\n </DemoGroup>\n <DemoGroup title=\"表单示例\"><ComplexFormExample host={host}/></DemoGroup>\n </view>;\n}\n","props":[],"events":[],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-avatar-bg","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-avatar-collapse-bg","defaultValue":"#ebedf0","description":""},{"name":"--cso-ui-avatar-collapse-color","defaultValue":"#969799","description":""},{"name":"--cso-ui-avatar-text","defaultValue":"var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted))","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-picker-fade-bottom","defaultValue":"linear-gradient(180deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-picker-fade-top","defaultValue":"linear-gradient(0deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-tag-default-color","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-tag-light-cyan-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-danger-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-default-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-lightblue-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-pink-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-primary-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-purple-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-success-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-volcano-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-warning-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","颜色与组件默认值"],"title":"颜色与组件默认值","section":"组件样式","description":"通过 `themeVars` 覆盖主题变量,通过 `button` 设置按钮的默认属性。","language":"tsx","code":"<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n","blocks":[{"language":"tsx","code":"<ConfigProvider\n themeVars={{ primary: '#7c3aed', buttonRadius: 8 }}\n button={{ round: true, size: 'large' }}\n>\n <Button label=\"主题按钮\" />\n</ConfigProvider>\n"}]}],"allowUnknownProps":false},{"name":"useCountDown","id":"count-down","label":"CountDown 倒计时","category":"反馈","categoryId":"feedback","kind":"hook","description":"倒计时用于显示剩余时间,支持格式化、毫秒显示和命令式控制。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useCountDown.ts","docPath":"docs/ui/components/count-down.md","doc":"# CountDown 倒计时\n\n倒计时用于显示剩余时间,支持格式化、毫秒显示和命令式控制。\n\n```tsx\nimport { CountDown } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 显示剩余时间\n\n通过 `time` 设置倒计时时长,单位为 ms。\n\n```tsx\n<CountDown time={3600000} />\n```\n\n## 组件样式\n\n### 自定义格式\n\n通过 `format` 指定显示格式,例如 `mm:ss` 展示分钟和秒。\n\n```tsx\n<CountDown time={90000} format=\"mm:ss\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| time | 剩余时长,单位 ms | `number` | `0` |\n| millisecond | 是否启用毫秒级更新 | `boolean` | `false` |\n| autoStart | 是否自动开始 | `boolean` | `true` |\n| format | 显示格式或是否启用格式化 | `string` | `'HH:mm:ss'` |\n| children | 自定义内容 | `ReactNode\\|((current:TimeData)=>ReactNode)` | — |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (current:TimeData)=>void |\n| onFinish | 对应操作发生时触发 | ()=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 自定义内容 | ReactNode\\|((current:TimeData)=>ReactNode) |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| start | 调用实例方法 | ()=>void |\n| pause | 调用实例方法 | ()=>void |\n| reset | 重置状态 | ()=>void |\n\n## 数据类型\n\n```tsx\nexport type TimeData = {\n total: number;\n days: number;\n hours: number;\n minutes: number;\n seconds: number;\n milliseconds: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-text` | 共享主题 |\n\n## 源代码\n\n[CountDown 组件源码](./sources/count-down/CountDown.tsx.txt) · [示例源码](./sources/count-down/demo.tsx.txt) · [文档源码](./sources/count-down/docs.md.txt)\n","demoSource":"import { useRef } from '@lynx-js/react';\nimport { CountDown, Grid, GridItem, Toast, useToast } from 'daisu-ui';\nimport type { CountDownRef } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst time=30*60*60*1000;\nexport function CountDownExample(){const ref=useRef<CountDownRef>(null),toast=useToast();return <view className=\"demo-count-down-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><CountDown time={time}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"自定义格式\"><CountDown time={time} format=\"DD 天 HH 时 mm 分 ss 秒\"/></ExampleBlock><ExampleBlock title=\"毫秒级渲染\"><CountDown time={time} millisecond format=\"HH:mm:ss:SS\"/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"自定义样式\"><CountDown time={time}>{current=><view className=\"demo-count-down-custom\"><text className=\"demo-count-down-unit\">{current.hours}</text><text className=\"demo-count-down-colon\">:</text><text className=\"demo-count-down-unit\">{current.minutes}</text><text className=\"demo-count-down-colon\">:</text><text className=\"demo-count-down-unit\">{current.seconds}</text></view>}</CountDown></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"手动控制\"><CountDown ref={ref} time={3000} millisecond autoStart={false} format=\"ss:SSS\" onFinish={()=>{ 'background only';toast.show('倒计时结束');}}/><Grid clickable border><GridItem text=\"开始\" icon=\"play-circle\" onItemClick={()=>{ 'background only';ref.current?.start();}}/><GridItem text=\"暂停\" icon=\"pause-circle\" onItemClick={()=>{ 'background only';ref.current?.pause();}}/><GridItem text=\"重置\" icon=\"refresh\" onItemClick={()=>{ 'background only';ref.current?.reset();}}/></Grid></ExampleBlock></DemoGroup><Toast {...toast.props}/>\n</view>;}\n","props":[{"name":"time","type":"number","optional":true,"description":"剩余时长,单位 ms","defaultValue":"0"},{"name":"millisecond","type":"boolean","optional":true,"description":"是否启用毫秒级更新","defaultValue":"false","values":[false,true]}],"events":[{"name":"onChange","type":"(current:TimeData)=>void","optional":true,"description":"值发生变化时触发"},{"name":"onFinish","type":"()=>void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"start","description":"调用实例方法","type":"()=>void"},{"name":"pause","description":"调用实例方法","type":"()=>void"},{"name":"reset","description":"重置状态","type":"()=>void"}],"cssVars":[{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"}],"demos":[{"name":"basic","aliases":["demo-1","显示剩余时间"],"title":"显示剩余时间","section":"基础用法","description":"通过 `time` 设置倒计时时长,单位为 ms。","language":"tsx","code":"<CountDown time={3600000} />\n","blocks":[{"language":"tsx","code":"<CountDown time={3600000} />\n"}]},{"name":"demo-2","aliases":["demo-2","自定义格式"],"title":"自定义格式","section":"组件样式","description":"通过 `format` 指定显示格式,例如 `mm:ss` 展示分钟和秒。","language":"tsx","code":"<CountDown time={90000} format=\"mm:ss\" />\n","blocks":[{"language":"tsx","code":"<CountDown time={90000} format=\"mm:ss\" />\n"}]}],"allowUnknownProps":false},{"name":"useDialog","id":"dialog","label":"Dialog 对话框","category":"反馈","categoryId":"feedback","kind":"hook","description":"对话框用于确认操作、展示提醒或收集简单输入,支持异步确认与自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useDialog.ts","docPath":"docs/ui/components/dialog.md","doc":"# Dialog 对话框\n\n对话框用于确认操作、展示提醒或收集简单输入,支持异步确认与自定义内容。\n\n```tsx\nimport { Dialog } from 'daisu-ui';\n```\n\n## 组件类型\n\n### 消息提醒\n\n将 `useDialog()` 返回的 `props` 绑定到 `Dialog`,调用 `alert()` 显示提醒,通过 `title` 和 `msg` 设置内容。\n\n```tsx\nimport { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n```\n\n### 确认操作\n\n调用 `confirm()` 显示确认对话框,用户确认时 Promise 完成,取消时进入拒绝分支。\n\n```tsx\nconst dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n```\n\n## 组件样式\n\n### 按钮主题\n\n设置 `theme=\"button\"` 使用按钮样式的操作区。\n\n```tsx\n<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| title | ReactNode 标题 / 纯文本正文 | `ReactNode` | — |\n| msg | ReactNode 标题 / 纯文本正文 | `string` | — |\n| type | alert/confirm/prompt | `'alert' \\| 'confirm' \\| 'prompt'` | `'alert'` |\n| theme | button/text;horizontal/vertical | `'button' \\| 'text'` | `'button'` |\n| actionLayout | button/text;horizontal/vertical | `'horizontal' \\| 'vertical'` | `'horizontal'` |\n| actions | {text,action?:confirm/cancel/action,...公共ButtonProps}[],优先于默认按钮 | `readonly DialogAction[]` | — |\n| showCancelButton | 取消按钮 | `boolean` | — |\n| confirmButtonText | 默认文案 | `string` | `'确定'` |\n| cancelButtonText | 默认文案 | `string` | `'取消'` |\n| confirmButtonProps | 部分DialogAction或string;null隐藏按钮 | `Partial<DialogAction> \\| string \\| null` | — |\n| cancelButtonProps | 部分DialogAction或string;null隐藏按钮 | `Partial<DialogAction> \\| string \\| null` | — |\n| inputValue | 初始值;{placeholder,maxlength,type,multiline,maxlines} | `string \\| number` | `''` |\n| inputProps | 初始值;{placeholder,maxlength,type,multiline,maxlines} | `DialogInputProps` | — |\n| inputPattern | 正则 / (string)=>boolean或错误字符串 | `RegExp` | — |\n| inputValidate | 正则 / (string)=>boolean或错误字符串 | `(value: string) => boolean \\| string` | — |\n| inputError | 校验提示 | `string` | `'输入内容不正确'` |\n| showErr | 校验提示 | `boolean` | `false` |\n| beforeConfirm | (string)=>boolean或Promise<boolean>;false拦截,异常显示可重试错误 | `(value: string) => boolean \\| Promise<boolean>` | — |\n| icon | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| iconColor | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| headerImage | 公共Icon名称/语义success、danger、warning、info / 颜色 / 头图地址 | `string` | — |\n| closeOnClickModal | 遮罩关闭 / 关闭按钮 | `boolean` | `false` |\n| showClose | 遮罩关闭 / 关闭按钮 | `boolean` | `false` |\n| zIndex | 层级 / 懒挂载 | `number` | `99` |\n| lazyRender | 层级 / 懒挂载 | `boolean` | `true` |\n| requestKey | useDialog内部请求编号,替换请求时使旧确认失效 | `number` | `0` |\n| show | 受控显示 / 关闭请求 / {action,value,index?}结果 | `boolean` | `false` |\n| rootPortal | 原生Portal,需Host | `boolean` | `false` |\n| className | 自定义样式 | `string` | `''` |\n| style | 自定义样式 | `CSSProperties` | — |\n| children | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | `ReactNode` | — |\n| header | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 受控显示 / 关闭请求 / {action,value,index?}结果 | (show: boolean) => void |\n| onResult | 受控显示 / 关闭请求 / {action,value,index?}结果 | (result: DialogResult) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| title | ReactNode 标题 / 纯文本正文 | ReactNode |\n| children | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | ReactNode |\n| header | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | ReactNode |\n| renderActions | 内容、头部、操作区;renderActions接收confirm/cancel/close/pending | (controls: { confirm: () => void; cancel: () => void; close: () => void; pending: boolean }) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type DialogAction = Omit<ButtonProps, 'onTap' | 'label'> & {\n text: string;\n action?: 'confirm' | 'cancel' | 'action';\n};\n\nexport type DialogResult = {\n action: 'confirm' | 'cancel' | 'modal' | 'close' | 'action';\n value: string;\n index?: number;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-canvas` | 共享主题 |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-line` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-text-muted` | 共享主题 |\n\n## 源代码\n\n[Dialog 组件源码](./sources/dialog/Dialog.tsx.txt) · [示例源码](./sources/dialog/demo.tsx.txt) · [文档源码](./sources/dialog/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport type { ReactNode } from '@lynx-js/react';\nimport { Button, Cell, Dialog, Rate, useDialog } from 'daisu-ui';\nimport type { DialogOptions, ButtonTone } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport banner from '../../../assets/demo-capybara.jpg';\n\ntype Sample = { label: string; options: DialogOptions; tone?: ButtonTone; content?: 'rating' | 'custom'; header?: boolean; customTitle?: boolean; customActions?: boolean };\nconst base: DialogOptions = { title: '提示', msg: '这是一条消息提示' };\nconst confirm: DialogOptions = { title: '提示', msg: '确认执行此操作吗?', type: 'confirm' };\nconst prompt: DialogOptions = { title: '请输入内容', type: 'prompt', inputProps: { placeholder: '请输入' } };\nconst sample = (label: string, options: DialogOptions, extra?: Omit<Sample, 'label' | 'options'>): Sample => ({ label, options, ...extra });\nconst groups: { title: string; blocks: { title: string; samples: Sample[] }[] }[] = [\n { title: '组件类型', blocks: [\n { title: '基础用法', samples: [sample('Alert 弹窗', base), sample('Confirm 弹窗', confirm), sample('Prompt 输入框', prompt), sample('标题 + 内容', { title: '操作提示', msg: '您的请求已经提交,我们会尽快处理。' })] },\n { title: '弹窗类型', samples: [sample('Alert 类型', base, { tone: 'success' }), sample('Confirm 类型', confirm), sample('Prompt 类型', prompt, { tone: 'warning' })] },\n ] },\n { title: '组件状态', blocks: [\n { title: '输入配置(Prompt)', samples: [sample('带占位符', { ...prompt, inputProps: { placeholder: '请输入内容' } }), sample('带默认值', { ...prompt, inputValue: '默认内容' }), sample('多行文本输入', { ...prompt, inputProps: { multiline: true, placeholder: '请输入详细内容' } }), sample('限制输入长度', { ...prompt, inputProps: { maxlength: 10, placeholder: '最多输入10个字' } }), sample('正则校验', { ...prompt, title: '请输入邮箱', inputPattern: /.+@.+\\..+/i, inputError: '邮箱格式不正确' }), sample('函数校验', { ...prompt, title: '请输入手机号', inputValidate: value => /^1[3-9]\\d{9}$/.test(value), inputError: '手机号格式不正确' }), sample('数字输入', { ...prompt, inputProps: { type: 'number' } }), sample('密码输入', { ...prompt, inputProps: { type: 'password' } })] },\n { title: '交互功能', samples: [sample('显示关闭按钮', { ...base, showClose: true }), sample('点击遮罩关闭', { ...base, closeOnClickModal: true }), sample('确认前钩子', { ...prompt, inputProps: { placeholder: '输入 confirm 以确认' }, beforeConfirm: value => value === 'confirm' }), sample('异步确认前钩子', { ...confirm, beforeConfirm: () => new Promise(resolve => setTimeout(() => resolve(true), 1500)) }), sample('自定义层级', { ...base, zIndex: 200 })] },\n { title: '按钮状态', samples: [sample('按钮加载状态', { ...base, showClose: true, confirmButtonProps: { loading: true } }), sample('禁用按钮', { ...confirm, confirmButtonProps: { disabled: true } })] },\n ] },\n { title: '组件变体', blocks: [\n { title: '弹窗风格', samples: [sample('Button 风格(默认)', confirm), sample('Text 风格(iOS 风格)', { ...confirm, theme: 'text' }), sample('Text 风格 + 垂直布局', { ...confirm, theme: 'text', actionLayout: 'vertical' })] },\n { title: '操作按钮配置', samples: [sample('自定义按钮文本', { ...confirm, confirmButtonText: '立即前往', cancelButtonText: '再想想' }), sample('自定义按钮样式', { ...confirm, confirmButtonProps: { tone: 'success' }, cancelButtonProps: { tone: 'danger' } }), sample('垂直排列按钮', { ...confirm, actionLayout: 'vertical' }), sample('单个按钮', { ...confirm, cancelButtonProps: null }), sample('多个按钮(Actions)', { title: '选择支付方式', actionLayout: 'vertical', actions: [{ text: '微信支付', tone: 'success' }, { text: '支付宝', tone: 'primary' }, { text: '取消', tone: 'neutral', action: 'cancel' }] })] },\n ] },\n { title: '组件样式', blocks: [{ title: '图标与头图', samples: [\n sample('成功图标', { ...base, icon: 'success', iconColor: '#12b886' }), sample('危险图标', { ...base, icon: 'danger', iconColor: '#f14646' }), sample('警告图标', { ...base, icon: 'warning', iconColor: '#f57f00' }), sample('信息图标', { ...base, icon: 'info', iconColor: '#1c64fd' }), sample('自定义图标', { ...base, icon: 'star-fill', iconColor: '#f57f00' }), sample('顶部图片(完整)', { ...base, headerImage: banner }), sample('顶部图片 + 标题', { title: '活动通知', headerImage: banner }), sample('顶部图片 + 内容', { msg: '恭喜您获得专属权益', headerImage: banner }), sample('顶部图片(纯图片)', { headerImage: banner, showClose: true, confirmButtonProps: null }), sample('自定义按钮配色', { ...base, confirmButtonProps: { tone: 'success' } }),\n ] }] },\n { title: '特殊样式', blocks: [\n { title: '插槽能力', samples: [sample('默认插槽:自定义内容', { title: '请为我们评分', type: 'confirm' }, { content: 'rating' }), sample('Header 插槽:顶部图片', base, { header: true }), sample('Title 插槽:自定义标题', base, { customTitle: true }), sample('Actions 插槽:多支付方式', { title: '请选择支付方式' }, { customActions: true })] },\n { title: '业务场景示例', samples: [sample('删除确认', { title: '删除确认', msg: '删除后无法恢复,确定删除吗?', type: 'confirm', confirmButtonProps: { text: '删除', tone: 'danger' } }), sample('支付确认', { title: '支付确认', msg: '确认支付 ¥99.00?', type: 'confirm' }), sample('表单提交', { title: '提交成功', msg: '您的信息已提交成功', icon: 'success' }), sample('用户反馈选择', { title: '反馈类型', actionLayout: 'vertical', actions: [{ text: '功能建议' }, { text: '问题反馈' }, { text: '取消', action: 'cancel', tone: 'neutral' }] }), sample('版本更新', { title: '版本更新', msg: '发现新版本,是否立即更新?', type: 'confirm' }), sample('拨打电话', { title: '拨打电话', msg: '10086', type: 'confirm', confirmButtonText: '确定' }), sample('地址录入', { ...prompt, title: '请输入地址', inputProps: { multiline: true, placeholder: '请输入详细地址' } }), sample('领取优惠券', { title: '优惠券', msg: '恭喜您获得满100减20优惠券', confirmButtonText: '立即领取' })] },\n ] },\n];\n\nexport function DialogExample() {\n const dialog = useDialog();\n const [current, setCurrent] = useState<Sample | null>(null);\n const [rating, setRating] = useState(3);\n const [result, setResult] = useState('');\n const open = (entry: Sample) => {\n 'background only'; setCurrent(entry); setResult('');\n void dialog.show(entry.options).then(value => setResult(value.value ? `输入内容:${value.value}` : '点击了确认')).catch(() => {});\n };\n const title: ReactNode = current?.customTitle ? <view className=\"demo-dialog-title\"><text>自定义标题</text><text>温馨提示</text></view> : dialog.props.title;\n return <view>{groups.map(group => <DemoGroup key={group.title} title={group.title}>{group.blocks.map(block => <ExampleBlock key={block.title} title={block.title}><view className=\"demo-dialog-buttons\">{block.samples.map(entry => <Button key={entry.label} block label={entry.label} tone={entry.tone} onTap={() => open(entry)} />)}</view></ExampleBlock>)}</DemoGroup>)}\n <Dialog {...dialog.props} title={title} rootPortal className=\"ui-demo-page\" header={current?.header ? <image className=\"ui-dialog-header-image\" src={banner} mode=\"aspectFill\" /> : undefined} renderActions={current?.customActions ? ({ confirm, cancel }) => <view className=\"demo-dialog-custom-actions\"><Button label=\"微信支付\" tone=\"success\" block onTap={confirm} /><Button label=\"支付宝\" block onTap={confirm} /><Button label=\"取消\" tone=\"neutral\" variant=\"plain\" block onTap={cancel} /></view> : undefined}>\n {current?.content === 'rating' ? <view className=\"demo-dialog-rating\"><Rate value={rating} onChange={({ value }) => setRating(value)} /><text>{rating} 分</text></view> : undefined}\n </Dialog>\n {result ? <view className=\"demo-action-sheet-notice\" bindtap={() => setResult('')}><text>{result}</text></view> : null}\n </view>;\n}\n","props":[],"events":[],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"}],"demos":[{"name":"basic","aliases":["demo-1","消息提醒"],"title":"消息提醒","section":"组件类型","description":"将 `useDialog()` 返回的 `props` 绑定到 `Dialog`,调用 `alert()` 显示提醒,通过 `title` 和 `msg` 设置内容。","language":"tsx","code":"import { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n","blocks":[{"language":"tsx","code":"import { useDialog, Button } from 'daisu-ui';\n\nconst dialog = useDialog();\n\n<Button\n label=\"显示提醒\"\n onTap={() => {\n 'background only';\n void dialog.alert({ title: '提示', msg: '操作已完成' });\n }}\n/>\n<Dialog {...dialog.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","确认操作"],"title":"确认操作","section":"组件类型","description":"调用 `confirm()` 显示确认对话框,用户确认时 Promise 完成,取消时进入拒绝分支。","language":"tsx","code":"const dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n","blocks":[{"language":"tsx","code":"const dialog = useDialog();\n\n<Button\n label=\"删除\"\n onTap={async () => {\n 'background only';\n try {\n await dialog.confirm({\n title: '删除确认',\n msg: '确定删除这条记录吗?',\n });\n console.log('已确认');\n } catch {\n console.log('已取消');\n }\n }}\n/>\n<Dialog {...dialog.props} />\n"}]},{"name":"demo-3","aliases":["demo-3","按钮主题"],"title":"按钮主题","section":"组件样式","description":"设置 `theme=\"button\"` 使用按钮样式的操作区。","language":"tsx","code":"<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n","blocks":[{"language":"tsx","code":"<Dialog show={false} title=\"操作确认\" msg=\"请选择操作\" theme=\"button\" />\n"}]}],"allowUnknownProps":false},{"name":"useImagePreview","id":"image-preview","label":"ImagePreview 图片预览","category":"数据展示","categoryId":"display","kind":"hook","description":"图片预览用于全屏查看图片组,支持切换、缩放、长按事件与自定义内容。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useImagePreview.ts","docPath":"docs/ui/components/image-preview.md","doc":"# ImagePreview 图片预览\n\n图片预览用于全屏查看图片组,支持切换、缩放、长按事件与自定义内容。\n\n```tsx\nimport { ImagePreview } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 打开预览\n\n将 `useImagePreview()` 返回的 `props` 绑定到 `ImagePreview`,调用 `previewImage()` 并传入 `images` 打开预览。\n\n```tsx\nimport { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n```\n\n## 内容形态\n\n### 多张图片\n\n通过 `images` 设置图片组,通过 `startPosition` 指定初始显示的图片索引。\n\n```tsx\nconst preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| images | 预览图片地址列表 | `readonly string[]` | — |\n| startPosition | 预览初始索引 | `number` | — |\n| showIndex | 是否显示当前索引 | `boolean` | — |\n| loop | 是否循环切换 | `boolean` | — |\n| closeable | 是否展示关闭入口 | `boolean` | — |\n| closeIcon | 关闭图标 | `string` | — |\n| closeIconPosition | 关闭图标位置 | `'top-left'\\|'top-right'` | — |\n| closeOnClick | 点击内容是否关闭 | `boolean` | — |\n| zIndex | 浮层层级 | `number` | — |\n| show | 是否显示 | `boolean` | — |\n| options | 选项配置 | `ImagePreviewOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| duration | 动画或显示时长,单位 ms | `number` | `300` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onOpen | 打开时触发 | ()=>void |\n| onClose | 关闭时触发 | ()=>void |\n| onChange | 值发生变化时触发 | (index:number)=>void |\n| onClick | 点击时触发 | (index:number)=>void |\n| onLongPress | 对应操作发生时触发 | (index:number)=>void |\n| onShowChange | 显示状态变化时触发 | (show:boolean)=>void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| renderClose | 自定义区域内容 | (close:()=>void)=>ReactNode |\n| renderIndicator | 自定义区域内容 | (info:{current:number;total:number})=>ReactNode |\n| renderContent | 自定义内容 | (info:ImagePreviewSlot)=>ReactNode |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | (input?:readonly string[]\\|ImagePreviewOptions)=>void |\n| close | 关闭面板 | ()=>void |\n| setActive | 调用实例方法 | (index:number)=>void |\n\n## 数据类型\n\n```tsx\nexport type ImagePreviewOptions = {\n images?: readonly string[];\n startPosition?: number;\n showIndex?: boolean;\n loop?: boolean;\n closeable?: boolean;\n closeIcon?: string;\n closeIconPosition?: 'top-left' | 'top-right';\n closeOnClick?: boolean;\n zIndex?: number;\n onOpen?: () => void;\n onClose?: () => void;\n onChange?: (index: number) => void;\n onClick?: (index: number) => void;\n onLongPress?: (index: number) => void;\n};\n\nexport type ImagePreviewSlot = {\n current: number;\n total: number;\n images: readonly string[];\n close: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-image-preview-bg` | 当前组件 |\n\n## 源代码\n\n[ImagePreview 组件源码](./sources/image-preview/ImagePreview.tsx.txt) · [示例源码](./sources/image-preview/demo.tsx.txt) · [文档源码](./sources/image-preview/docs.md.txt)\n","demoSource":"import { Button, ImagePreview, SwiperNav, useImagePreview } from 'daisu-ui';\nimport type { ImagePreviewOptions } from 'daisu-ui';\nimport redpanda from '../../../assets/demo-red-panda.jpg';\nimport capybara from '../../../assets/demo-capybara.jpg';\nimport panda from '../../../assets/demo-panda.jpg';\nimport moon from '../../../assets/demo-moon.jpg';\nimport meng from '../../../assets/demo-landscape.jpg';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst images=[redpanda,capybara,panda,moon,meng],labels=['小熊猫','水豚','大熊猫','月亮','萌宠'];\nexport function ImagePreviewExample(){\n const preview=useImagePreview(),custom=useImagePreview();\n const open=(input:ImagePreviewOptions={})=>{ 'background only';preview.previewImage({images,...input}); };\n return <view className=\"demo-image-preview-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Button label=\"预览图片\" onTap={()=>open()}/></ExampleBlock><ExampleBlock title=\"传入图片数组\"><Button label=\"直接传入数组\" onTap={()=>preview.previewImage(images)}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件变体\"><ExampleBlock title=\"指定起始位置\"><Button label=\"从第二张开始\" onTap={()=>open({startPosition:1})}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件配置\"><ExampleBlock title=\"隐藏页码\"><Button label=\"不显示页码\" onTap={()=>open({showIndex:false})}/></ExampleBlock><ExampleBlock title=\"隐藏关闭按钮\"><Button label=\"不显示关闭按钮\" onTap={()=>open({closeable:false})}/></ExampleBlock><ExampleBlock title=\"关闭按钮位置\"><Button label=\"左上角\" onTap={()=>open({closeIconPosition:'top-left'})}/><Button label=\"右上角\" onTap={()=>open({closeIconPosition:'top-right'})}/></ExampleBlock><ExampleBlock title=\"禁用点击关闭\"><Button label=\"点击不关闭\" onTap={()=>open({closeOnClick:false})}/></ExampleBlock><ExampleBlock title=\"禁用循环\"><Button label=\"禁用循环播放\" onTap={()=>open({loop:false})}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊用法\"><ExampleBlock title=\"监听事件\"><Button label=\"带事件回调\" onTap={()=>open({onOpen:()=>console.info('预览已打开'),onClose:()=>console.info('预览已关闭'),onChange:index=>console.info('当前图片索引:',index)})}/></ExampleBlock><ExampleBlock title=\"使用插槽\"><Button label=\"自定义插槽\" onTap={()=>custom.previewImage({images,showIndex:false})}/></ExampleBlock></DemoGroup>\n <ImagePreview {...preview.props} rootPortal/>\n <ImagePreview {...custom.props} rootPortal renderIndicator={({current,total})=><SwiperNav current={current} total={total} type=\"dots-bar\" style={{bottom:'64px'}}/>} renderContent={({current})=><text className=\"demo-image-preview-bottom\">{labels[current]}</text>}/>\n </view>;\n}\n","props":[{"name":"images","type":"readonly string[]","optional":true,"description":"预览图片地址列表"},{"name":"startPosition","type":"number","optional":true,"description":"预览初始索引"},{"name":"showIndex","type":"boolean","optional":true,"description":"是否显示当前索引","values":[false,true]},{"name":"loop","type":"boolean","optional":true,"description":"是否循环切换","values":[false,true]},{"name":"closeable","type":"boolean","optional":true,"description":"是否展示关闭入口","values":[false,true]},{"name":"closeIcon","type":"string","optional":true,"description":"关闭图标"},{"name":"closeIconPosition","type":"'top-left'|'top-right'","optional":true,"description":"关闭图标位置","values":["top-left","top-right"]},{"name":"closeOnClick","type":"boolean","optional":true,"description":"点击内容是否关闭","values":[false,true]},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"}],"events":[{"name":"onOpen","type":"()=>void","optional":true,"description":"打开时触发"},{"name":"onClose","type":"()=>void","optional":true,"description":"关闭时触发"},{"name":"onChange","type":"(index:number)=>void","optional":true,"description":"值发生变化时触发"},{"name":"onClick","type":"(index:number)=>void","optional":true,"description":"点击时触发"},{"name":"onLongPress","type":"(index:number)=>void","optional":true,"description":"对应操作发生时触发"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"(input?:readonly string[]|ImagePreviewOptions)=>void"},{"name":"close","description":"关闭面板","type":"()=>void"},{"name":"setActive","description":"调用实例方法","type":"(index:number)=>void"}],"cssVars":[{"name":"--cso-ui-image-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""}],"demos":[{"name":"basic","aliases":["demo-1","打开预览"],"title":"打开预览","section":"基础用法","description":"将 `useImagePreview()` 返回的 `props` 绑定到 `ImagePreview`,调用 `previewImage()` 并传入 `images` 打开预览。","language":"tsx","code":"import { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n","blocks":[{"language":"tsx","code":"import { useImagePreview, Button } from 'daisu-ui';\n\nconst preview = useImagePreview();\n\n<Button\n label=\"预览图片\"\n onTap={() => {\n 'background only';\n preview.previewImage({ images: ['https://example.com/photo.jpg'] });\n }}\n/>\n<ImagePreview {...preview.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","多张图片"],"title":"多张图片","section":"内容形态","description":"通过 `images` 设置图片组,通过 `startPosition` 指定初始显示的图片索引。","language":"tsx","code":"const preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n","blocks":[{"language":"tsx","code":"const preview = useImagePreview();\n\n<Button\n label=\"查看相册\"\n onTap={() => {\n 'background only';\n preview.previewImage({\n images: ['https://example.com/a.jpg', 'https://example.com/b.jpg'],\n startPosition: 1,\n });\n }}\n/>\n<ImagePreview {...preview.props} />\n"}]}],"allowUnknownProps":false},{"name":"useNotify","id":"notify","label":"Notify 消息通知","category":"反馈","categoryId":"feedback","kind":"hook","description":"消息通知用于展示页面级状态,支持成功、警告、失败以及不同位置和外观。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useNotify.ts","docPath":"docs/ui/components/notify.md","doc":"# Notify 消息通知\n\n消息通知用于展示页面级状态,支持成功、警告、失败以及不同位置和外观。\n\n```tsx\nimport { Notify } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 绑定通知实例\n\n将 `useNotify()` 返回的 `props` 绑定到 `Notify`,通过 `showNotify()` 显示通知。\n\n```tsx\nimport { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n```\n\n## 组件状态\n\n### 成功通知\n\n调用 `showNotify()` 时设置 `type=\"success\"`,通过 `message` 指定通知文案。\n\n```tsx\nconst notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| type | primary / success / warning / danger | `NotifyType` | — |\n| message | string 或 number;默认内容单行省略,复杂内容使用 children | `string \\| number` | — |\n| duration | 显示时长,ms;≤0 或非有限值不自动关闭,不含离场动画时间 | `number` | — |\n| position | top / bottom | `NotifyPosition` | — |\n| color | 自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色 | `string` | — |\n| background | 自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色 | `string` | — |\n| zIndex | 浮层层级 | `number` | — |\n| safeHeight | 顶部偏移;数字及纯数字字符串为 px,rpx 转为 vw,其他有效 CSS 长度直接传递 | `number \\| string` | — |\n| safeAreaBottom | 宿主提供的底部安全区,有限非负 px;仅 bottom 使用 | `number` | — |\n| rootPortal | 使用现有原生 Portal 逃离滚动与裁剪容器 | `boolean` | — |\n| closable | 展示关闭按钮,catchtap 阻止其触发 onClick | `boolean` | — |\n| variant | filled 使用状态浅色背景;floating 使用表面色、12px 外边距、8px 圆角与静态阴影 | `NotifyVariant` | — |\n| className | 通知内容容器的类与样式 | `string` | — |\n| style | 通知内容容器的类与样式 | `CSSProperties` | — |\n| visible | 受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态 | `boolean` | `false` |\n| requestKey | 内容连续展示时递增,以重新开始计时;useNotify 自动管理 | `number` | `0` |\n| options | 同名 NotifyOptions 覆盖组件直接传入的默认选项;不含 visible、children 等控制属性 | `NotifyOptions` | — |\n| children | 替换 message,可放公共组件及多行自定义内容 | `ReactNode` | — |\n| prefix | 默认类型图标;传 null 隐藏,ReactNode 自定义 | `ReactNode` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onClick | 点击通知正文;参数为 Lynx TouchEvent,不会自动关闭 | (event: TouchEvent) => void |\n| onOpened | 入场 / 离场动画完成后调用;快速反向会取消过期阶段 | () => void |\n| onClosed | 入场 / 离场动画完成后调用;快速反向会取消过期阶段 | () => void |\n| onChange | 受控显隐;自动到时或关闭按钮调用 onChange(false),调用方应回写状态 | (visible: boolean) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| children | 替换 message,可放公共组件及多行自定义内容 | ReactNode |\n| prefix | 默认类型图标;传 null 隐藏,ReactNode 自定义 | ReactNode |\n| renderClose | `(close: () => void) => ReactNode`,closable 为 true 时使用 | (close: () => void) => ReactNode |\n\n## 数据类型\n\n```tsx\nexport type NotifyType = 'primary' | 'success' | 'warning' | 'danger';\n\nexport type NotifyPosition = 'top' | 'bottom';\n\nexport type NotifyVariant = 'filled' | 'floating';\n\nexport type NotifyOptions = {\n type?: NotifyType;\n message?: string | number;\n duration?: number;\n position?: NotifyPosition;\n color?: string;\n background?: string;\n zIndex?: number;\n safeHeight?: number | string;\n safeAreaBottom?: number;\n rootPortal?: boolean;\n closable?: boolean;\n variant?: NotifyVariant;\n className?: string;\n style?: CSSProperties;\n onClick?: (event: TouchEvent) => void;\n onOpened?: () => void;\n onClosed?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-danger` | 共享主题 |\n| `--cso-ui-danger-soft` | 共享主题 |\n| `--cso-ui-primary` | 共享主题 |\n| `--cso-ui-primary-soft` | 共享主题 |\n| `--cso-ui-success` | 共享主题 |\n| `--cso-ui-success-soft` | 共享主题 |\n| `--cso-ui-surface` | 共享主题 |\n| `--cso-ui-text` | 共享主题 |\n| `--cso-ui-warning` | 共享主题 |\n| `--cso-ui-warning-soft` | 共享主题 |\n\n## 源代码\n\n[Notify 组件源码](./sources/notify/Notify.tsx.txt) · [示例源码](./sources/notify/demo.tsx.txt) · [文档源码](./sources/notify/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Cell, CellGroup, ConfigProvider, Icon, Notify, useConfigProvider, useNotify } from 'daisu-ui';\nimport type { NotifyType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nconst types: { type:NotifyType; title:string }[] = [{ type:'primary',title:'主要通知' },{ type:'success',title:'成功通知' },{ type:'danger',title:'危险通知' },{ type:'warning',title:'警告通知' }];\nexport function NotifyExample() {\n const notify = useNotify(), [visible,setVisible] = useState(false), [requestKey,setRequestKey] = useState(0), config = useConfigProvider();\n const dark = config.theme === 'dark';\n const themeVars = { primary:dark ? '#5b90ff' : '#1c64fd', success:dark ? '#20c997' : '#12b886', warning:dark ? '#ffa94d' : '#f57f00', danger:dark ? '#ff6b6b' : '#f14646', surface:dark ? '#000' : '#fff', text:dark ? '#f7f8fa' : '#1d1f29', '--cso-ui-primary-soft':dark ? '#0d2a77' : '#f5f8ff', '--cso-ui-success-soft':dark ? '#053c2c' : '#f3fbf9', '--cso-ui-warning-soft':dark ? '#542905' : '#fff6eb', '--cso-ui-danger-soft':dark ? '#571111' : '#fff5f5' };\n return <view className=\"demo-notify-page\">\n <DemoGroup title=\"组件状态\"><ExampleBlock title=\"基础用法\" noPadding><CellGroup><Cell title=\"基础用法\" arrow onTap={() => { 'background only'; notify.showNotify('测试'); }} /></CellGroup></ExampleBlock><ExampleBlock title=\"自定义配置\" noPadding><CellGroup><Cell title=\"自定义颜色\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义颜色',color:config.theme === 'dark' ? '#ff6b6b' : '#f14646',background:'var(--cso-ui-danger-soft)' }); }} /><Cell title=\"自定义位置\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义位置',position:'bottom' }); }} /><Cell title=\"自定义时长\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'自定义时长',duration:1000 }); }} /><Cell title=\"显示关闭按钮\" arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',closable:true,duration:0 }); }} /></CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"通知类型\" noPadding><CellGroup>{types.map(({type,title}) => <Cell key={type} title={title} arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',type }); }} />)}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"组件样式\"><ExampleBlock title=\"悬浮通知\" noPadding><CellGroup>{types.map(({type,title}) => <Cell key={type} title={title} arrow onTap={() => { 'background only'; notify.showNotify({ message:'通知内容',type,variant:'floating',closable:true }); }} />)}</CellGroup></ExampleBlock></DemoGroup>\n <DemoGroup title=\"内容形态\"><ExampleBlock title=\"使用 Notify 组件\" noPadding><CellGroup><Cell title=\"使用 Notify 组件\" arrow onTap={() => { 'background only'; setRequestKey(value => value+1); setVisible(true); }} /></CellGroup></ExampleBlock></DemoGroup>\n <ConfigProvider themeVars={themeVars}><Notify {...notify.props} safeHeight={44} rootPortal /><Notify visible={visible} onChange={setVisible} requestKey={requestKey} type=\"success\" duration={2000} safeHeight={44} rootPortal><view className=\"demo-notify-custom-content\"><Icon name=\"check-outline\" size={15} color={config.theme === 'dark' ? '#20c997' : '#12b886'} /><text>成功通知</text></view></Notify></ConfigProvider>\n </view>;\n}\n","props":[{"name":"type","type":"NotifyType","optional":true,"description":"primary / success / warning / danger","values":["primary","success","warning","danger"]},{"name":"message","type":"string | number","optional":true,"description":"string 或 number;默认内容单行省略,复杂内容使用 children"},{"name":"duration","type":"number","optional":true,"description":"显示时长,ms;≤0 或非有限值不自动关闭,不含离场动画时间"},{"name":"position","type":"NotifyPosition","optional":true,"description":"top / bottom","values":["bottom","top"]},{"name":"color","type":"string","optional":true,"description":"自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色"},{"name":"background","type":"string","optional":true,"description":"自定义文字、前缀及关闭图标颜色 / 背景颜色,支持有效 Lynx CSS 颜色"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级"},{"name":"safeHeight","type":"number | string","optional":true,"description":"顶部偏移;数字及纯数字字符串为 px,rpx 转为 vw,其他有效 CSS 长度直接传递"},{"name":"safeAreaBottom","type":"number","optional":true,"description":"宿主提供的底部安全区,有限非负 px;仅 bottom 使用"},{"name":"rootPortal","type":"boolean","optional":true,"description":"使用现有原生 Portal 逃离滚动与裁剪容器","values":[false,true]},{"name":"closable","type":"boolean","optional":true,"description":"展示关闭按钮,catchtap 阻止其触发 onClick","values":[false,true]},{"name":"variant","type":"NotifyVariant","optional":true,"description":"filled 使用状态浅色背景;floating 使用表面色、12px 外边距、8px 圆角与静态阴影","values":["filled","floating"]},{"name":"className","type":"string","optional":true,"description":"通知内容容器的类与样式"},{"name":"style","type":"CSSProperties","optional":true,"description":"通知内容容器的类与样式"}],"events":[{"name":"onClick","type":"(event: TouchEvent) => void","optional":true,"description":"点击通知正文;参数为 Lynx TouchEvent,不会自动关闭"},{"name":"onOpened","type":"() => void","optional":true,"description":"入场 / 离场动画完成后调用;快速反向会取消过期阶段"},{"name":"onClosed","type":"() => void","optional":true,"description":"入场 / 离场动画完成后调用;快速反向会取消过期阶段"}],"slots":[],"methods":[],"cssVars":[{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-danger-soft","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-soft","defaultValue":"#fff3eb","description":""},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-success-soft","defaultValue":"#f3fbf9","description":""},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"},{"name":"--cso-ui-warning-soft","defaultValue":"#fff6eb","description":""}],"demos":[{"name":"basic","aliases":["demo-1","绑定通知实例"],"title":"绑定通知实例","section":"基础用法","description":"将 `useNotify()` 返回的 `props` 绑定到 `Notify`,通过 `showNotify()` 显示通知。","language":"tsx","code":"import { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n","blocks":[{"language":"tsx","code":"import { useNotify, Button } from 'daisu-ui';\n\nconst notify = useNotify();\n\n<Button\n label=\"显示通知\"\n onTap={() => {\n 'background only';\n notify.showNotify('这是一条通知');\n }}\n/>\n<Notify {...notify.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","成功通知"],"title":"成功通知","section":"组件状态","description":"调用 `showNotify()` 时设置 `type=\"success\"`,通过 `message` 指定通知文案。","language":"tsx","code":"const notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n","blocks":[{"language":"tsx","code":"const notify = useNotify();\n\n<Button\n label=\"保存成功\"\n onTap={() => {\n 'background only';\n notify.showNotify({ type: 'success', message: '信息保存成功' });\n }}\n/>\n<Notify {...notify.props} />\n"}]}],"allowUnknownProps":false},{"name":"usePressState","id":"use-press-state","label":"usePressState","category":"公共 API","categoryId":"api","kind":"hook","description":"Explicit feedback works in both native Lynx and the H5 custom element runtime.","importFrom":"daisu-ui/utils","source":"packages/daisu-ui/src/usePressState.ts","doc":"","props":[{"name":"valueOf","type":"boolean","optional":false,"description":"Returns the primitive value of the specified object."}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"useRoute","id":"use-route","label":"useRoute","category":"公共 API","categoryId":"api","kind":"hook","description":"Kept-alive pages receive their own route, even while a different page is on top.","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"useRouteMatch","id":"use-route-match","label":"useRouteMatch","category":"公共 API","categoryId":"api","kind":"hook","description":"Each keepalive scene owns its match data; covered pages never read top-page params.","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"useRouter","id":"use-router","label":"useRouter","category":"公共 API","categoryId":"api","kind":"hook","description":"useRouter 公开 Hook","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"useRouterSnapshot","id":"use-router-snapshot","label":"useRouterSnapshot","category":"公共 API","categoryId":"api","kind":"hook","description":"useRouterSnapshot 公开 Hook","importFrom":"daisu-ui/router","source":"packages/daisu-ui/src/router/hooks.tsx","doc":"","props":[{"name":"engine","type":"TanStackRouter<AnyRoute, \"never\", false, import(\"@tanstack/history\").RouterHistory, Record<string, any>>","optional":false,"description":"Diagnostic/advanced TanStack access. Route changes must use the guarded facade."},{"name":"navigate","type":"<const TTo extends string | undefined, const TFrom extends string = string>(navigation: SceneNavigateOptions<TTree, TTo, TFrom>) => Promise<boolean>","optional":false,"description":""},{"name":"route","type":"R","optional":false,"description":""},{"name":"routes","type":"R[]","optional":false,"description":""},{"name":"snapshot","type":"RouterSnapshot<R>","optional":false,"description":""},{"name":"href","type":"(route: R) => string","optional":false,"description":""},{"name":"serialize","type":"RouterHistoryState","optional":false,"description":""},{"name":"whenIdle","type":"() => Promise<boolean>","optional":false,"description":"Wait for an openBusiness navigation, whose return value means \"handled\"."},{"name":"load","type":"() => Promise<boolean>","optional":false,"description":""},{"name":"push","type":"(location: string, replace?: boolean) => NavigationResult","optional":false,"description":""},{"name":"replace","type":"(location: string) => NavigationResult","optional":false,"description":""},{"name":"back","type":"NavigationResult","optional":false,"description":""},{"name":"reset","type":"NavigationResult","optional":false,"description":""},{"name":"restore","type":"NavigationResult","optional":false,"description":""},{"name":"subscribe","type":"(listener: (snapshot: RouterSnapshot<R>, navigation: Navigation<R>) => void) => () => void","optional":false,"description":""},{"name":"beforeEach","type":"(guard: NavigationGuard<R>) => () => void","optional":false,"description":""},{"name":"afterEach","type":"(listener: (navigation: Navigation<R>) => void) => () => void","optional":false,"description":""}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false},{"name":"useToast","id":"toast","label":"Toast 轻提示","category":"反馈","categoryId":"feedback","kind":"hook","description":"轻提示用于短暂反馈操作结果,支持文字、成功、失败和持续加载等状态。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useToast.ts","docPath":"docs/ui/components/toast.md","doc":"# Toast 轻提示\n\n轻提示用于短暂反馈操作结果,支持文字、成功、失败和持续加载等状态。\n\n```tsx\nimport { Toast } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 绑定提示实例\n\n调用 `useToast()`,将返回的 `props` 绑定到 `Toast`,通过 `show()` 显示文字提示。\n\n```tsx\nimport { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n```\n\n## 组件状态\n\n### 成功与加载\n\n通过 `success()` 显示成功提示,通过 `loading()` 显示持续加载,通过 `close()` 手动关闭。\n\n```tsx\nconst toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| msg | 消息正文 | `string` | — |\n| duration | 动画或显示时长,单位 ms | `number` | — |\n| direction | 布局或展开方向 | `ToastDirection` | — |\n| iconName | 状态图标类型 | `ToastIconType` | — |\n| iconSize | 图标尺寸 | `number` | — |\n| loadingType | 加载动画类型 | `ToastLoadingType` | — |\n| loadingColor | 加载指示器颜色 | `string` | — |\n| loadingSize | 加载指示器尺寸 | `number` | — |\n| iconColor | 图标颜色 | `string` | — |\n| position | 显示位置 | `ToastPosition` | — |\n| zIndex | 浮层层级 | `number` | — |\n| cover | 是否添加覆盖层 | `boolean` | — |\n| iconClass | A public Icon name or image URL, rather than an iconfont class. | `string` | — |\n| iconNode | 自定义图标内容 | `ReactNode` | — |\n| opened | 打开动画结束回调 | `() => void` | — |\n| closed | 关闭动画结束回调 | `() => void` | — |\n| show | 是否显示 | `boolean` | `false` |\n| options | 选项配置 | `ToastOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onChange | 值发生变化时触发 | (show: boolean) => void |\n\n## 内容插槽\n\n| 名称 | 说明 | 类型 |\n| --- | --- | --- |\n| iconNode | 自定义图标内容 | ReactNode |\n\n## 数据类型\n\n```tsx\nexport type ToastDirection = 'horizontal' | 'vertical';\n\nexport type ToastIconType =\n | 'success'\n | 'error'\n | 'warning'\n | 'loading'\n | 'info';\n\nexport type ToastLoadingType = 'circular' | 'spinner' | 'dots';\n\nexport type ToastPosition = 'top' | 'middle-top' | 'middle' | 'bottom';\n\nexport type ToastOptions = {\n msg?: string;\n duration?: number;\n direction?: ToastDirection;\n iconName?: ToastIconType;\n iconSize?: number;\n loadingType?: ToastLoadingType;\n loadingColor?: string;\n loadingSize?: number;\n iconColor?: string;\n position?: ToastPosition;\n zIndex?: number;\n cover?: boolean;\n /** A public Icon name or image URL, rather than an iconfont class. */\n iconClass?: string;\n iconNode?: ReactNode;\n opened?: () => void;\n closed?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Toast 组件源码](./sources/toast/Toast.tsx.txt) · [示例源码](./sources/toast/demo.tsx.txt) · [文档源码](./sources/toast/docs.md.txt)\n","demoSource":"import { useEffect, useRef } from '@lynx-js/react';\nimport { Button, Toast, useToast } from 'daisu-ui';\nimport type { ToastLoadingType } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport customIcon from '../../../assets/demo-recycle.svg';\n\nconst longText = '这是一段很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的文案';\nconst poem = '芦叶满汀洲,寒沙带浅流。二十年重过南楼。柳下系船犹未稳,能几日,又中秋。黄鹤断矶头,故人曾到否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。';\n\nexport function ToastExample() {\n const toast = useToast();\n const timer = useRef<ReturnType<typeof setTimeout>>();\n useEffect(() => () => clearTimeout(timer.current), []);\n const run = (callback: () => void) => { 'background only'; clearTimeout(timer.current); callback(); };\n const loading = (type: ToastLoadingType, vertical = false) => run(() => {\n toast.loading({ msg: vertical ? poem : '3s后自动关闭', loadingType: type, direction: vertical ? 'vertical' : 'horizontal' });\n timer.current = setTimeout(toast.close, 3000);\n });\n return <view className=\"demo-toast-page\">\n <DemoGroup title=\"组件类型\">\n <ExampleBlock title=\"基本用法\"><view className=\"demo-toast-buttons\"><Button label=\"toast\" onTap={() => run(() => toast.show('提示信息'))} /><Button label=\"长文案\" onTap={() => run(() => toast.show(longText))} /></view></ExampleBlock>\n <ExampleBlock title=\"类型toast\"><view className=\"demo-toast-buttons\"><Button label=\"成功toast\" onTap={() => run(() => toast.success('操作成功'))} /><Button label=\"错误toast\" onTap={() => run(() => toast.error('手机验证码输入错误,请重新输入'))} /><Button label=\"警告toast\" onTap={() => run(() => toast.warning('提示信息'))} /><Button label=\"常规toast\" onTap={() => run(() => toast.info('常规提示信息'))} /></view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件状态\">\n <ExampleBlock title=\"Loading\"><view className=\"demo-toast-buttons\">{(['circular', 'spinner', 'dots'] as const).map(type => <Button key={type} label={type === 'circular' ? 'circular (默认)' : type} onTap={() => loading(type)} />)}</view></ExampleBlock>\n <ExampleBlock title=\"纵向布局loading\"><view className=\"demo-toast-buttons\">{(['circular', 'spinner', 'dots'] as const).map(type => <Button key={type} label={type} onTap={() => loading(type, true)} />)}</view></ExampleBlock>\n </DemoGroup>\n <DemoGroup title=\"组件样式\">\n <ExampleBlock title=\"使用图标\"><view className=\"demo-toast-buttons\"><Button label=\"内部图标\" onTap={() => run(() => toast.show({ iconClass: 'star', msg: '使用组件库内部图标' }))} /><Button label=\"自定义图标\" onTap={() => run(() => toast.show({ iconClass: customIcon, msg: '使用自定义图标' }))} /></view></ExampleBlock>\n <ExampleBlock title=\"提示位置\"><view className=\"demo-toast-buttons\">{(['top', 'middle', 'bottom'] as const).map((position, index) => <Button key={position} label={`${['顶部', '居中', '底部'][index]}toast`} onTap={() => run(() => toast.show({ position, msg: '提示信息' }))} />)}</view></ExampleBlock>\n <ExampleBlock title=\"排版方向\"><view className=\"demo-toast-buttons\">{(['horizontal', 'vertical'] as const).map((direction, index) => <Button key={direction} label={index ? '纵向排版' : '横向排版'} onTap={() => run(() => toast.success({ msg: poem, direction }))} />)}</view></ExampleBlock>\n </DemoGroup>\n <Toast {...toast.props} rootPortal />\n </view>;\n}\n","props":[],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","绑定提示实例"],"title":"绑定提示实例","section":"基础用法","description":"调用 `useToast()`,将返回的 `props` 绑定到 `Toast`,通过 `show()` 显示文字提示。","language":"tsx","code":"import { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n","blocks":[{"language":"tsx","code":"import { useToast, Button } from 'daisu-ui';\n\nconst toast = useToast();\n\n<Button\n label=\"显示提示\"\n onTap={() => {\n 'background only';\n toast.show('这是一条提示');\n }}\n/>\n<Toast {...toast.props} />\n"}]},{"name":"demo-2","aliases":["demo-2","成功与加载"],"title":"成功与加载","section":"组件状态","description":"通过 `success()` 显示成功提示,通过 `loading()` 显示持续加载,通过 `close()` 手动关闭。","language":"tsx","code":"const toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n","blocks":[{"language":"tsx","code":"const toast = useToast();\n\n<Button\n label=\"成功\"\n onTap={() => {\n 'background only';\n toast.success('保存成功');\n }}\n/>\n<Button\n label=\"加载\"\n onTap={() => {\n 'background only';\n toast.loading('加载中');\n }}\n/>\n<Button\n label=\"关闭\"\n onTap={() => {\n 'background only';\n toast.close();\n }}\n/>\n<Toast {...toast.props} />\n"}]}],"allowUnknownProps":false},{"name":"useVideoPreview","id":"video-preview","label":"VideoPreview 视频预览","category":"数据展示","categoryId":"display","kind":"hook","description":"视频预览用于展示可播放的视频内容,支持独立预览实例、全屏选项和打开、关闭、错误事件;当前提供浏览器后端。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/useVideoPreview.ts","docPath":"docs/ui/components/video-preview.md","doc":"# VideoPreview 视频预览\n\n视频预览用于展示可播放的视频内容,支持独立预览实例、全屏选项和打开、关闭、错误事件;当前提供浏览器后端。\n\n```tsx\nimport { VideoPreview } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 预览视频\n\n将 `useVideoPreview()` 返回的 `props` 绑定到 `VideoPreview`,在浏览器模式下通过 `previewVideo()` 传入视频 `url`。\n\n```tsx\nimport { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n```\n\n## 组件样式\n\n### 全屏预览\n\n调用 `previewVideo()` 时设置 `fullScreen` 使用全屏预览。\n\n```tsx\nconst preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n```\n\n## 平台与资源说明\n\n浏览器宿主须在挂载 lynx-view 前调用 daisu-ui/web 的 registerDaisuWebComponents,并设置 mediaMode=\"browser\"。使用 HTML5 播放控件,默认不自动播放,页面隐藏时暂停,关闭或卸载释放播放器。useVideoPreview 返回 props、previewVideo 和 closeVideoPreview,调用方须渲染绑定 props 的 VideoPreview,每个实例互相隔离。Flutter 后端待接入。\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| url | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| poster | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| title | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| zIndex | 公共Overlay层级 | `number` | — |\n| fullScreen | 播放区域填满预览层;默认区域高度248px;HTML5控件仍可进入浏览器原生全屏 | `boolean` | — |\n| closePosition | left-top / right-top,距边16px | `'left-top' \\| 'right-top'` | — |\n| show | 可选受控显示;hook提供同一组合 | `boolean` | — |\n| options | 选项配置 | `VideoPreviewOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| mediaMode | browser 开启已经注册的浏览器播放器;Flutter暂无后端 | `'browser' \\| 'none'` | `'none'` |\n| rootPortal | 使用时根部须已放置RootPortalHost | `boolean` | `false` |\n| duration | 公共Overlay淡入淡出毫秒数 | `number` | `300` |\n| className | 根层样式 | `string` | `''` |\n| style | 根层样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onOpen | 层实际打开和关闭时各触发一次;重复关闭不重复回调 | () => void |\n| onClose | 层实际打开和关闭时各触发一次;重复关闭不重复回调 | () => void |\n| onShowChange | 可选受控显示;hook提供同一组合 | (show: boolean) => void |\n| onError | {src,message},实际资源加载/播放失败及不支持的调用 | (error: { src: string; message: string }) => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | (video: VideoPreviewOptions) => boolean |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type VideoPreviewOptions = PreviewVideo & {\n zIndex?: number;\n fullScreen?: boolean;\n closePosition?: 'left-top' | 'right-top';\n onOpen?: () => void;\n onClose?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-video-preview-bg` | 当前组件 |\n| `--cso-ui-video-preview-video-height` | 当前组件 |\n\n## 源代码\n\n[VideoPreview 组件源码](./sources/video-preview/VideoPreview.tsx.txt) · [示例源码](./sources/video-preview/demo.tsx.txt) · [文档源码](./sources/video-preview/docs.md.txt)\n","demoSource":"import { useInitData, useRef, useState } from '@lynx-js/react';\nimport { Button, VideoPreview, useVideoPreview } from 'daisu-ui';\nimport type { VideoPreviewRef } from 'daisu-ui';\nimport poster from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport url from '../../../assets/demo-journey.mp4';\nexport function VideoPreviewExample(){\n const init=useInitData() as unknown,browser=!!init&&typeof init==='object'&&'browserMedia' in init&&init.browserMedia===true;\n const main=useVideoPreview(),sub=useVideoPreview(),ref=useRef<VideoPreviewRef>(null),[error,setError]=useState('');\n const video={url,poster,title:'视频预览'};\n return <view className=\"demo-video-preview-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Button disabled={!browser} label=\"点击预览视频\" onTap={()=>{'background only';main.previewVideo(video);}}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"多实例调用\"><Button disabled={!browser} label=\"默认实例\" onTap={()=>{'background only';main.previewVideo(video);}}/><Button disabled={!browser} label=\"指定实例\" onTap={()=>{'background only';sub.previewVideo({...video,title:'指定实例预览',closePosition:'right-top'});}}/></ExampleBlock>\n <ExampleBlock title=\"全屏预览\"><Button disabled={!browser} label=\"点击预览全屏视频\" onTap={()=>{'background only';main.previewVideo({...video,title:'全屏预览',fullScreen:true});}}/></ExampleBlock>\n <ExampleBlock title=\"组件实例调用\"><Button disabled={!browser} label=\"通过 ref 打开\" onTap={()=>{'background only';ref.current?.open(video);}}/></ExampleBlock>\n </DemoGroup>\n {!browser?<text className=\"demo-rich-hint\">当前环境暂不支持视频预览,请在浏览器中体验。</text>:null}{error?<text className=\"demo-rich-hint\">{error}</text>:null}\n <VideoPreview {...main.props} ref={ref} rootPortal mediaMode={browser?'browser':'none'} onError={({message})=>{'background only';setError(message);}}/>\n <VideoPreview {...sub.props} rootPortal mediaMode={browser?'browser':'none'} onError={({message})=>{'background only';setError(message);}}/>\n </view>;\n}\n","props":[{"name":"url","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"poster","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"title","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"zIndex","type":"number","optional":true,"description":"公共Overlay层级"},{"name":"fullScreen","type":"boolean","optional":true,"description":"播放区域填满预览层;默认区域高度248px;HTML5控件仍可进入浏览器原生全屏","values":[false,true]},{"name":"closePosition","type":"'left-top' | 'right-top'","optional":true,"description":"left-top / right-top,距边16px","values":["left-top","right-top"]}],"events":[{"name":"onOpen","type":"() => void","optional":true,"description":"层实际打开和关闭时各触发一次;重复关闭不重复回调"},{"name":"onClose","type":"() => void","optional":true,"description":"层实际打开和关闭时各触发一次;重复关闭不重复回调"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"(video: VideoPreviewOptions) => boolean"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-video-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""},{"name":"--cso-ui-video-preview-video-height","defaultValue":"248px","description":""}],"demos":[{"name":"basic","aliases":["demo-1","预览视频"],"title":"预览视频","section":"基础用法","description":"将 `useVideoPreview()` 返回的 `props` 绑定到 `VideoPreview`,在浏览器模式下通过 `previewVideo()` 传入视频 `url`。","language":"tsx","code":"import { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n","blocks":[{"language":"tsx","code":"import { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n"}]},{"name":"demo-2","aliases":["demo-2","全屏预览"],"title":"全屏预览","section":"组件样式","description":"调用 `previewVideo()` 时设置 `fullScreen` 使用全屏预览。","language":"tsx","code":"const preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n","blocks":[{"language":"tsx","code":"const preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n"}]}],"allowUnknownProps":false},{"name":"VideoPreview","id":"video-preview","label":"VideoPreview 视频预览","category":"数据展示","categoryId":"display","kind":"component","description":"视频预览用于展示可播放的视频内容,支持独立预览实例、全屏选项和打开、关闭、错误事件;当前提供浏览器后端。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/VideoPreview.tsx","docPath":"docs/ui/components/video-preview.md","doc":"# VideoPreview 视频预览\n\n视频预览用于展示可播放的视频内容,支持独立预览实例、全屏选项和打开、关闭、错误事件;当前提供浏览器后端。\n\n```tsx\nimport { VideoPreview } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 预览视频\n\n将 `useVideoPreview()` 返回的 `props` 绑定到 `VideoPreview`,在浏览器模式下通过 `previewVideo()` 传入视频 `url`。\n\n```tsx\nimport { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n```\n\n## 组件样式\n\n### 全屏预览\n\n调用 `previewVideo()` 时设置 `fullScreen` 使用全屏预览。\n\n```tsx\nconst preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n```\n\n## 平台与资源说明\n\n浏览器宿主须在挂载 lynx-view 前调用 daisu-ui/web 的 registerDaisuWebComponents,并设置 mediaMode=\"browser\"。使用 HTML5 播放控件,默认不自动播放,页面隐藏时暂停,关闭或卸载释放播放器。useVideoPreview 返回 props、previewVideo 和 closeVideoPreview,调用方须渲染绑定 props 的 VideoPreview,每个实例互相隔离。Flutter 后端待接入。\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| url | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| poster | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| title | 视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址 | `string` | — |\n| zIndex | 公共Overlay层级 | `number` | — |\n| fullScreen | 播放区域填满预览层;默认区域高度248px;HTML5控件仍可进入浏览器原生全屏 | `boolean` | — |\n| closePosition | left-top / right-top,距边16px | `'left-top' \\| 'right-top'` | — |\n| show | 可选受控显示;hook提供同一组合 | `boolean` | — |\n| options | 选项配置 | `VideoPreviewOptions` | — |\n| requestKey | 重复请求标识,变化时重置当前展示 | `number` | `0` |\n| mediaMode | browser 开启已经注册的浏览器播放器;Flutter暂无后端 | `'browser' \\| 'none'` | `'none'` |\n| rootPortal | 使用时根部须已放置RootPortalHost | `boolean` | `false` |\n| duration | 公共Overlay淡入淡出毫秒数 | `number` | `300` |\n| className | 根层样式 | `string` | `''` |\n| style | 根层样式 | `CSSProperties` | — |\n\n## Events 事件\n\n| 事件 | 说明 | 类型 |\n| --- | --- | --- |\n| onOpen | 层实际打开和关闭时各触发一次;重复关闭不重复回调 | () => void |\n| onClose | 层实际打开和关闭时各触发一次;重复关闭不重复回调 | () => void |\n| onShowChange | 可选受控显示;hook提供同一组合 | (show: boolean) => void |\n| onError | {src,message},实际资源加载/播放失败及不支持的调用 | (error: { src: string; message: string }) => void |\n\n## Methods 方法\n\n通过 ref 获取组件实例。\n\n| 方法 | 说明 | 类型 |\n| --- | --- | --- |\n| open | 打开面板 | (video: VideoPreviewOptions) => boolean |\n| close | 关闭面板 | () => void |\n\n## 数据类型\n\n```tsx\nexport type VideoPreviewOptions = PreviewVideo & {\n zIndex?: number;\n fullScreen?: boolean;\n closePosition?: 'left-top' | 'right-top';\n onOpen?: () => void;\n onClose?: () => void;\n};\n```\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n### CSS 变量\n\n以下变量可通过 ConfigProvider 的 themeVars 覆盖,未设置时使用当前主题与组件的默认样式。\n\n| 变量 | 作用范围 |\n| --- | --- |\n| `--cso-ui-video-preview-bg` | 当前组件 |\n| `--cso-ui-video-preview-video-height` | 当前组件 |\n\n## 源代码\n\n[VideoPreview 组件源码](./sources/video-preview/VideoPreview.tsx.txt) · [示例源码](./sources/video-preview/demo.tsx.txt) · [文档源码](./sources/video-preview/docs.md.txt)\n","demoSource":"import { useInitData, useRef, useState } from '@lynx-js/react';\nimport { Button, VideoPreview, useVideoPreview } from 'daisu-ui';\nimport type { VideoPreviewRef } from 'daisu-ui';\nimport poster from '../../../assets/demo-cat.png';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport url from '../../../assets/demo-journey.mp4';\nexport function VideoPreviewExample(){\n const init=useInitData() as unknown,browser=!!init&&typeof init==='object'&&'browserMedia' in init&&init.browserMedia===true;\n const main=useVideoPreview(),sub=useVideoPreview(),ref=useRef<VideoPreviewRef>(null),[error,setError]=useState('');\n const video={url,poster,title:'视频预览'};\n return <view className=\"demo-video-preview-page\">\n <DemoGroup title=\"组件类型\"><ExampleBlock title=\"基本用法\"><Button disabled={!browser} label=\"点击预览视频\" onTap={()=>{'background only';main.previewVideo(video);}}/></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"多实例调用\"><Button disabled={!browser} label=\"默认实例\" onTap={()=>{'background only';main.previewVideo(video);}}/><Button disabled={!browser} label=\"指定实例\" onTap={()=>{'background only';sub.previewVideo({...video,title:'指定实例预览',closePosition:'right-top'});}}/></ExampleBlock>\n <ExampleBlock title=\"全屏预览\"><Button disabled={!browser} label=\"点击预览全屏视频\" onTap={()=>{'background only';main.previewVideo({...video,title:'全屏预览',fullScreen:true});}}/></ExampleBlock>\n <ExampleBlock title=\"组件实例调用\"><Button disabled={!browser} label=\"通过 ref 打开\" onTap={()=>{'background only';ref.current?.open(video);}}/></ExampleBlock>\n </DemoGroup>\n {!browser?<text className=\"demo-rich-hint\">当前环境暂不支持视频预览,请在浏览器中体验。</text>:null}{error?<text className=\"demo-rich-hint\">{error}</text>:null}\n <VideoPreview {...main.props} ref={ref} rootPortal mediaMode={browser?'browser':'none'} onError={({message})=>{'background only';setError(message);}}/>\n <VideoPreview {...sub.props} rootPortal mediaMode={browser?'browser':'none'} onError={({message})=>{'background only';setError(message);}}/>\n </view>;\n}\n","props":[{"name":"url","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"poster","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"title","type":"string","optional":true,"description":"视频、封面与标题;支持HTTP(S)和相对地址,不执行脚本/data/file地址"},{"name":"zIndex","type":"number","optional":true,"description":"公共Overlay层级"},{"name":"fullScreen","type":"boolean","optional":true,"description":"播放区域填满预览层;默认区域高度248px;HTML5控件仍可进入浏览器原生全屏","values":[false,true]},{"name":"closePosition","type":"'left-top' | 'right-top'","optional":true,"description":"left-top / right-top,距边16px","values":["left-top","right-top"]},{"name":"show","type":"boolean","optional":true,"description":"可选受控显示;hook提供同一组合","values":[false,true]},{"name":"options","type":"VideoPreviewOptions","optional":true,"description":"选项配置"},{"name":"requestKey","type":"number","optional":true,"description":"重复请求标识,变化时重置当前展示","defaultValue":"0"},{"name":"mediaMode","type":"'browser' | 'none'","optional":true,"description":"browser 开启已经注册的浏览器播放器;Flutter暂无后端","defaultValue":"'none'","values":["none","browser"]},{"name":"rootPortal","type":"boolean","optional":true,"description":"使用时根部须已放置RootPortalHost","defaultValue":"false","values":[false,true]},{"name":"duration","type":"number","optional":true,"description":"公共Overlay淡入淡出毫秒数","defaultValue":"300"},{"name":"className","type":"string","optional":true,"description":"根层样式","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根层样式"}],"events":[{"name":"onOpen","type":"() => void","optional":true,"description":"层实际打开和关闭时各触发一次;重复关闭不重复回调"},{"name":"onClose","type":"() => void","optional":true,"description":"层实际打开和关闭时各触发一次;重复关闭不重复回调"},{"name":"onShowChange","type":"(show: boolean) => void","optional":true,"description":"可选受控显示;hook提供同一组合"},{"name":"onError","type":"(error: { src: string; message: string }) => void","optional":true,"description":"{src,message},实际资源加载/播放失败及不支持的调用"}],"slots":[],"methods":[{"name":"open","description":"打开面板","type":"(video: VideoPreviewOptions) => boolean"},{"name":"close","description":"关闭面板","type":"() => void"}],"cssVars":[{"name":"--cso-ui-video-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""},{"name":"--cso-ui-video-preview-video-height","defaultValue":"248px","description":""}],"demos":[{"name":"basic","aliases":["demo-1","预览视频"],"title":"预览视频","section":"基础用法","description":"将 `useVideoPreview()` 返回的 `props` 绑定到 `VideoPreview`,在浏览器模式下通过 `previewVideo()` 传入视频 `url`。","language":"tsx","code":"import { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n","blocks":[{"language":"tsx","code":"import { useVideoPreview, Button } from 'daisu-ui';\n\nconst preview = useVideoPreview();\n\n<Button\n label=\"播放视频\"\n onTap={() => {\n 'background only';\n preview.previewVideo({ url: 'https://example.com/movie.mp4' });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n"}]},{"name":"demo-2","aliases":["demo-2","全屏预览"],"title":"全屏预览","section":"组件样式","description":"调用 `previewVideo()` 时设置 `fullScreen` 使用全屏预览。","language":"tsx","code":"const preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n","blocks":[{"language":"tsx","code":"const preview = useVideoPreview();\n\n<Button\n label=\"全屏播放\"\n onTap={() => {\n 'background only';\n preview.previewVideo({\n url: 'https://example.com/movie.mp4',\n fullScreen: true,\n });\n }}\n/>\n<VideoPreview {...preview.props} mediaMode=\"browser\" />\n"}]}],"allowUnknownProps":false},{"name":"Watermark","id":"watermark","label":"Watermark 水印","category":"数据展示","categoryId":"display","kind":"component","description":"水印用于在内容区域重复展示文字或图片标记,支持颜色、旋转和间距配置。","importFrom":"daisu-ui","source":"packages/daisu-ui/src/Watermark.tsx","docPath":"docs/ui/components/watermark.md","doc":"# Watermark 水印\n\n水印用于在内容区域重复展示文字或图片标记,支持颜色、旋转和间距配置。\n\n```tsx\nimport { Watermark } from 'daisu-ui';\n```\n\n## 基础用法\n\n### 文字水印\n\n通过 `content` 设置水印文字,将水印层和页面内容放在同一容器中。\n\n```tsx\n<view style={{ height: '200px' }}>\n <text>内容区域</text>\n <Watermark content=\"Daisu UI\" />\n</view>\n```\n\n## 组件样式\n\n### 自定义文字\n\n通过 `size` 设置水印字号。\n\n```tsx\n<view style={{ height: '200px' }}>\n <Watermark content=\"内部资料\" size={16} />\n</view>\n```\n\n## Attributes 属性\n\n| 参数 | 说明 | 类型 / 可选值 | 默认值 |\n| --- | --- | --- | --- |\n| content | 内容 | `string` | `''` |\n| image | 自定义图片内容或地址 | `string` | `''` |\n| imageWidth | 图片宽度 | `number` | `100` |\n| imageHeight | 图片高度 | `number` | `100` |\n| gutterX | 水平方向间隔 | `number` | `0` |\n| gutterY | 垂直方向间隔 | `number` | `0` |\n| width | 宽度 | `number` | `100` |\n| height | 高度 | `number` | `100` |\n| fullScreen | 是否全屏显示 | `boolean` | `true` |\n| color | 内容颜色 | `string` | `'#c9cbd4'` |\n| size | 尺寸 | `number` | `14` |\n| fontStyle | 字体样式 | `'normal'\\|'italic'\\|'oblique'` | `'normal'` |\n| fontWeight | 字重 | `CSSProperties['fontWeight']\\|'bolder'\\|number` | `'normal'` |\n| fontFamily | 文字字体 | `string` | `'PingFang SC'` |\n| rotate | 旋转角度 | `number` | `-25` |\n| zIndex | 浮层层级 | `number` | `1100` |\n| opacity | 透明度 | `number` | `.6` |\n| layout | 排列方式 | `'grid'\\|'staggered'` | `'grid'` |\n| rootPortal | 挂载到 RootPortalHost;使用前需配置宿主 | `boolean` | `false` |\n| className | 根节点自定义类名 | `string` | `''` |\n| style | 根节点样式 | `CSSProperties` | — |\n\n## 主题定制\n\n页面主题可通过 [ConfigProvider 全局配置](config-provider.md) 统一设置。局部外观使用本组件属性表中的颜色、尺寸及自定义类名调整。\n\n```tsx\nimport { ConfigProvider } from 'daisu-ui';\n\n<ConfigProvider theme=\"dark\">\n {/* 页面内容 */}\n</ConfigProvider>\n```\n\n## 源代码\n\n[Watermark 组件源码](./sources/watermark/Watermark.tsx.txt) · [示例源码](./sources/watermark/demo.tsx.txt) · [文档源码](./sources/watermark/docs.md.txt)\n","demoSource":"import { useState } from '@lynx-js/react';\nimport { Button, Cell, CellGroup, Checkbox, CheckboxGroup, Radio, RadioGroup, Switch, Watermark } from 'daisu-ui';\nimport type { ChoiceValue } from 'daisu-ui';\nimport { DemoGroup, ExampleBlock } from './shared.js';\nimport logo from '../../../assets/daisu-ui-logo.svg';\nexport function WatermarkExample(){\n const [switches,setSwitches]=useState([true,false,true,false,true,false,true]),[checks,setChecks]=useState<ChoiceValue[]>(['1','2']),[radio,setRadio]=useState<string|null>('1'),[global,setGlobal]=useState(false),[image,setImage]=useState(false),[staggered,setStaggered]=useState(false);\n return <view className=\"demo-watermark-page\"><DemoGroup title=\"组件类型\"><ExampleBlock title=\"局部文字水印\"><view className=\"demo-watermark-wrap\"><Watermark fullScreen={false} content=\"Daisu UI\"/><CellGroup border>{['消息通知','声音提醒','震动反馈','深色模式','自动更新','定位服务','省电模式'].map((title,index)=><Cell key={title} title={title} center><Switch style={{alignSelf:'flex-end'}} inactiveColor=\"var(--cso-ui-line)\" value={switches[index]} onChange={({value})=>{ 'background only';setSwitches(previous=>previous.map((item,i)=>i===index?Boolean(value):item)); }}/></Cell>)}</CellGroup></view></ExampleBlock><ExampleBlock title=\"局部图片水印\"><view className=\"demo-watermark-wrap\"><Watermark fullScreen={false} image={logo} imageWidth={38} imageHeight={38}/><CheckboxGroup className=\"demo-watermark-choices\" value={checks} onChange={({value})=>{ 'background only';setChecks(value); }} type=\"square\" placement=\"right\">{['查看权限','编辑权限','删除权限','导出数据','分享链接','邀请成员','管理设置'].map((label,index)=><Checkbox key={label} name={String(index+1)}>{label}</Checkbox>)}</CheckboxGroup></view></ExampleBlock><ExampleBlock title=\"局部多行文字水印\"><view className=\"demo-watermark-wrap\"><Watermark fullScreen={false} width={150} height={150} content=\"多行文字水印测试自动换行效果展示,这是一段很长的文本\"/><RadioGroup className=\"demo-watermark-choices\" value={radio} onChange={value=>{ 'background only';setRadio(value); }} type=\"dot\" placement=\"right\">{['简体中文','繁体中文','English','日本語','Français','Deutsch','Español'].map((label,index)=><Radio key={label} value={String(index+1)}>{label}</Radio>)}</RadioGroup></view></ExampleBlock></DemoGroup>\n <DemoGroup title=\"特殊样式\"><ExampleBlock title=\"全局水印\"><view className=\"demo-watermark-global-actions\"><Button size=\"small\" label={global?'关闭全局水印':'开启全局水印'} onTap={()=>{ 'background only';setGlobal(value=>!value); }}/>{global?<><Button size=\"small\" tone=\"info\" label={image?'切换为文字':'切换为图片'} onTap={()=>{ 'background only';setImage(value=>!value); }}/><Button size=\"small\" tone=\"warning\" label={staggered?'网格布局':'错位布局'} onTap={()=>{ 'background only';setStaggered(value=>!value); }}/></>:null}</view></ExampleBlock></DemoGroup>\n {global?<Watermark rootPortal width={130} height={140} content=\"Daisu UI\" image={image?logo:undefined} imageWidth={38} imageHeight={38} layout={staggered?'staggered':'grid'}/>:null}\n </view>;\n}\n","props":[{"name":"content","type":"string","optional":true,"description":"内容","defaultValue":"''"},{"name":"image","type":"string","optional":true,"description":"自定义图片内容或地址","defaultValue":"''"},{"name":"imageWidth","type":"number","optional":true,"description":"图片宽度","defaultValue":"100"},{"name":"imageHeight","type":"number","optional":true,"description":"图片高度","defaultValue":"100"},{"name":"gutterX","type":"number","optional":true,"description":"水平方向间隔","defaultValue":"0"},{"name":"gutterY","type":"number","optional":true,"description":"垂直方向间隔","defaultValue":"0"},{"name":"width","type":"number","optional":true,"description":"宽度","defaultValue":"100"},{"name":"height","type":"number","optional":true,"description":"高度","defaultValue":"100"},{"name":"fullScreen","type":"boolean","optional":true,"description":"是否全屏显示","defaultValue":"true","values":[false,true]},{"name":"color","type":"string","optional":true,"description":"内容颜色","defaultValue":"'#c9cbd4'"},{"name":"size","type":"number","optional":true,"description":"尺寸","defaultValue":"14"},{"name":"fontStyle","type":"'normal'|'italic'|'oblique'","optional":true,"description":"字体样式","defaultValue":"'normal'","values":["italic","normal","oblique"]},{"name":"fontWeight","type":"CSSProperties['fontWeight']|'bolder'|number","optional":true,"description":"字重","defaultValue":"'normal'"},{"name":"fontFamily","type":"string","optional":true,"description":"文字字体","defaultValue":"'PingFang SC'"},{"name":"rotate","type":"number","optional":true,"description":"旋转角度","defaultValue":"-25"},{"name":"zIndex","type":"number","optional":true,"description":"浮层层级","defaultValue":"1100"},{"name":"opacity","type":"number","optional":true,"description":"透明度","defaultValue":".6"},{"name":"layout","type":"'grid'|'staggered'","optional":true,"description":"排列方式","defaultValue":"'grid'","values":["grid","staggered"]},{"name":"rootPortal","type":"boolean","optional":true,"description":"挂载到 RootPortalHost;使用前需配置宿主","defaultValue":"false","values":[false,true]},{"name":"className","type":"string","optional":true,"description":"根节点自定义类名","defaultValue":"''"},{"name":"style","type":"CSSProperties","optional":true,"description":"根节点样式"}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[{"name":"basic","aliases":["demo-1","文字水印"],"title":"文字水印","section":"基础用法","description":"通过 `content` 设置水印文字,将水印层和页面内容放在同一容器中。","language":"tsx","code":"<view style={{ height: '200px' }}>\n <text>内容区域</text>\n <Watermark content=\"Daisu UI\" />\n</view>\n","blocks":[{"language":"tsx","code":"<view style={{ height: '200px' }}>\n <text>内容区域</text>\n <Watermark content=\"Daisu UI\" />\n</view>\n"}]},{"name":"demo-2","aliases":["demo-2","自定义文字"],"title":"自定义文字","section":"组件样式","description":"通过 `size` 设置水印字号。","language":"tsx","code":"<view style={{ height: '200px' }}>\n <Watermark content=\"内部资料\" size={16} />\n</view>\n","blocks":[{"language":"tsx","code":"<view style={{ height: '200px' }}>\n <Watermark content=\"内部资料\" size={16} />\n</view>\n"}]}],"allowUnknownProps":false},{"name":"zodAdapter","id":"zod-adapter","label":"zodAdapter","category":"公共 API","categoryId":"api","kind":"utility","description":"Structural adapter: Zod stays an optional application dependency.","importFrom":"daisu-ui","source":"packages/daisu-ui/src/formModel.ts","doc":"","props":[{"name":"safeParseAsync","type":"(model: unknown) => Promise<{ success: boolean; error?: { issues: readonly { path: readonly PropertyKey[]; message: string }[] } }>","optional":false,"description":""}],"events":[],"slots":[],"methods":[],"cssVars":[],"demos":[],"allowUnknownProps":false}],"cssVars":[{"name":"--cso-ui-avatar-bg","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-avatar-collapse-bg","defaultValue":"#ebedf0","description":""},{"name":"--cso-ui-avatar-collapse-color","defaultValue":"#969799","description":""},{"name":"--cso-ui-avatar-text","defaultValue":"var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted))","description":""},{"name":"--cso-ui-button-font-size","defaultValue":"16px","description":"默认尺寸的字号"},{"name":"--cso-ui-button-height","defaultValue":"40px","description":"默认尺寸的高度"},{"name":"--cso-ui-button-pressed-opacity","defaultValue":"0.85","description":"实心按钮按压透明度"},{"name":"--cso-ui-button-primary-bg","defaultValue":"跟随 --cso-ui-primary","description":"主要按钮背景色"},{"name":"--cso-ui-button-primary-color","defaultValue":"跟随 --cso-ui-on-primary","description":"主要按钮文字与加载指示器颜色"},{"name":"--cso-ui-button-radius","defaultValue":"4px","description":"默认圆角"},{"name":"--cso-ui-calendar-range-bg","defaultValue":"#202127","description":""},{"name":"--cso-ui-canvas","description":"共享语义主题变量","defaultValue":"#f5f7fa","darkValue":"#10151c"},{"name":"--cso-ui-cell-title-color","defaultValue":"var(--cso-ui-text)","description":""},{"name":"--cso-ui-control-surface","defaultValue":"var(--cso-ui-surface)","description":""},{"name":"--cso-ui-count-to-font-size","defaultValue":"18px","description":""},{"name":"--cso-ui-count-to-line-height","defaultValue":"26px","description":""},{"name":"--cso-ui-curtain-radius","defaultValue":"8px","description":""},{"name":"--cso-ui-danger","description":"共享语义主题变量","defaultValue":"#d63b47","darkValue":"#ff7f8a"},{"name":"--cso-ui-danger-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-danger-soft","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-danger-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-dark-display","defaultValue":"none","description":""},{"name":"--cso-ui-disabled-text","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-divider-line-color","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-divider-line-width","defaultValue":"1px","description":""},{"name":"--cso-ui-empty-padding-bottom","defaultValue":"24px","description":""},{"name":"--cso-ui-hero","defaultValue":"#17212e","description":"共享语义主题变量","darkValue":"#0c1117"},{"name":"--cso-ui-hero-muted","defaultValue":"#d5dbe4","description":"共享语义主题变量","darkValue":"#b4c0d0"},{"name":"--cso-ui-hero-text","defaultValue":"#fff","description":"共享语义主题变量","darkValue":"#f7f9fc"},{"name":"--cso-ui-image-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""},{"name":"--cso-ui-img-loading-bg","defaultValue":"#f7f8fa","description":""},{"name":"--cso-ui-info","description":"共享语义主题变量","defaultValue":"#236fd4","darkValue":"#78aeff"},{"name":"--cso-ui-light-display","defaultValue":"flex","description":""},{"name":"--cso-ui-line","description":"共享语义主题变量","defaultValue":"#e6eaf0","darkValue":"#303b4a"},{"name":"--cso-ui-line-strong","defaultValue":"var(--cso-ui-line)","description":""},{"name":"--cso-ui-notice-bar-danger-bg","defaultValue":"#fff5f5","description":""},{"name":"--cso-ui-notice-bar-info-bg","defaultValue":"#f5f8ff","description":""},{"name":"--cso-ui-notice-bar-radius","defaultValue":"0px","description":""},{"name":"--cso-ui-notice-bar-warning-bg","defaultValue":"#fff6eb","description":""},{"name":"--cso-ui-on-primary","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#16110d"},{"name":"--cso-ui-picker-fade-bottom","defaultValue":"linear-gradient(180deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-picker-fade-top","defaultValue":"linear-gradient(0deg,rgba(0,0,0,.2),rgba(0,0,0,.85))","description":""},{"name":"--cso-ui-primary","description":"共享语义主题变量","defaultValue":"#f86100","darkValue":"#ff812e"},{"name":"--cso-ui-primary-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-primary-soft","defaultValue":"#fff3eb","description":""},{"name":"--cso-ui-primary-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-rich-text-color","defaultValue":"var(--cso-ui-text)","description":""},{"name":"--cso-ui-rich-text-font-size","defaultValue":"14px","description":""},{"name":"--cso-ui-rich-text-image-state-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-rich-text-image-state-color","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-rich-text-line-height","defaultValue":"1.7","description":""},{"name":"--cso-ui-rich-text-video-height","defaultValue":"225px","description":""},{"name":"--cso-ui-signature-background","defaultValue":"#fff","description":""},{"name":"--cso-ui-skeleton-bg","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-skeleton-highlight","defaultValue":"var(--ui-skeleton-highlight)","description":""},{"name":"--cso-ui-step-dot-finished-bg","defaultValue":"#b8cfff","description":""},{"name":"--cso-ui-step-finished-bg","defaultValue":"#f5f8ff","description":""},{"name":"--cso-ui-success","description":"共享语义主题变量","defaultValue":"#1f9d67","darkValue":"#56c891"},{"name":"--cso-ui-success-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-success-soft","defaultValue":"#f3fbf9","description":""},{"name":"--cso-ui-success-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""},{"name":"--cso-ui-surface","description":"共享语义主题变量","defaultValue":"#fff","darkValue":"#171e27"},{"name":"--cso-ui-surface-muted","description":"共享语义主题变量","defaultValue":"#f8fafc","darkValue":"#202936"},{"name":"--cso-ui-swiper-dot-active-color","defaultValue":"#fff","description":""},{"name":"--cso-ui-swiper-dot-color","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-table-stripe-bg","defaultValue":"var(--cso-ui-canvas)","description":""},{"name":"--cso-ui-tag-default-color","defaultValue":"#e5e6eb","description":""},{"name":"--cso-ui-tag-light-cyan-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-danger-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-default-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-lightblue-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-pink-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-primary-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-purple-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-success-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-volcano-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-tag-light-warning-bg","defaultValue":"var(--cso-ui-surface-muted)","description":""},{"name":"--cso-ui-text","description":"共享语义主题变量","defaultValue":"#17212e","darkValue":"#f3f6fa"},{"name":"--cso-ui-text-auxiliary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-disabled","defaultValue":"#c9cbd4","description":""},{"name":"--cso-ui-text-muted","description":"共享语义主题变量","defaultValue":"#697586","darkValue":"#aeb9c8"},{"name":"--cso-ui-text-placeholder","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-text-secondary","defaultValue":"var(--cso-ui-text-muted)","description":""},{"name":"--cso-ui-video-preview-bg","defaultValue":"rgba(0,0,0,.75)","description":""},{"name":"--cso-ui-video-preview-video-height","defaultValue":"248px","description":""},{"name":"--cso-ui-warning","description":"共享语义主题变量","defaultValue":"#b86b00","darkValue":"#f0b450"},{"name":"--cso-ui-warning-pressed","defaultValue":"var(--ui-button-color)","description":""},{"name":"--cso-ui-warning-soft","defaultValue":"#fff6eb","description":""},{"name":"--cso-ui-warning-soft-pressed","defaultValue":"var(--ui-button-soft)","description":""}],"changelog":[{"version":"0.1.0-beta.1","date":"2026-11-25","content":"2026-11-25 · 开发中\n\n- 增加随仓库使用的本地 stdio MCP 文档服务,提供组件、API、Demo、主题变量、全文搜索与更新记录查询;补充通用 JSON、Cursor、VS Code 和 Codex 配置及真实客户端集成测试。\n- 文档站增加分组指南、设计系统与 AI 导航,统一左侧目录和顶部菜单,提供 AI 总览、文档搜索及版本更新定位,支持键盘、触屏与明暗主题。\n- 清理组件注释、使用指南、示例内容及远程资源引用。\n- 内置图标切换至 Tabler Icons 3.53.0,保留现有 305 个图标名称。\n- 演示插画、视频与旋律使用本仓库生成的本地资源,水印使用 Daisu UI 标志。","components":[]},{"version":"0.1.0-beta.0","date":"2026-11-25","content":"2026-11-25 · 开发中\n\n### 新增\n\n- 将应用内通用 UI 提取为独立 ReactLynx npm 包。\n- 提供保留 JSX 的 ESM、TypeScript 声明和完整组件样式。\n- 从组件入口自动加载样式,支持生产构建 tree shaking,无需单独导入 CSS。\n- 提供独立 router、router/runtime 与 utils 入口。\n- 提供独立交互 Demo 与 Web 组件文档站,包含使用示例、API 表格和本页目录。\n- 提供站内源码查看器,支持高亮、复制与源码链接直接访问。\n- 增加更新日志页面及组件分类导航。\n\n### 优化\n\n- 统一组件文档的说明、代码和交互预览布局。\n- 文档构建同步生成最新组件库与 Demo,避免预览使用旧产物。\n\n### 修复\n\n- 修复文档底部源码链接触发下载的问题,改为站内查看。\n\n### 版本说明\n\n- 业务组件及 Flutter 宿主适配由应用维护。\n- 首个 beta,原生平台完整回归待完成。","components":[]}]}