├── .eslintignore ├── .eslintrc.js ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug-report.zh-CN.yml │ ├── config.yml │ └── feature-report.zh-CN.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── issue-shoot.md └── workflows │ ├── auto-release.yml │ ├── issue-assignees.temp.yml │ ├── issue-help-wanted.temp.yml │ ├── issue-label.yml │ ├── issue-mark-duplicate.temp.yml │ ├── issue-reply.temp.yml │ ├── issue-synchronize.temp.yml │ ├── pkg-pr-new.yml │ ├── pr-comment-ci.yml │ ├── pr-compressed-size.yml │ ├── pr-spelling.template.yml │ ├── preview-publish.yml │ ├── pull-request.yml │ ├── tag-push.yml │ └── typos-config.toml ├── .gitignore ├── .gitmodules ├── .husky ├── commit-msg ├── pre-commit └── prepare-commit-msg ├── .prettierrc.js ├── .vscode ├── component.code-snippets └── settings.json ├── CHANGELOG.md ├── DEVELOP_GUIDE.md ├── LICENSE ├── README.md ├── babel.config.js ├── commitlint.config.js ├── package.json ├── postcss.config.js ├── script ├── generate-coverage.js ├── generate-css-vars.js ├── generate-icon-demo.js └── rollup.config.js ├── site ├── .env.intranet ├── docs │ ├── getting-started.en-US.md │ ├── getting-started.md │ ├── overview.en-US.md │ └── overview.md ├── index.html ├── mobile.html ├── mobile │ ├── App.jsx │ ├── components │ │ ├── DemoBlock.jsx │ │ ├── DemoHeader.jsx │ │ ├── Header.jsx │ │ └── style │ │ │ └── index.less │ ├── main.jsx │ ├── mobile.config.js │ └── utils.js ├── plugin-tdoc │ ├── demo.js │ ├── index.js │ ├── md-to-react.js │ └── transforms.js ├── public │ ├── apple-touch-icon.png │ ├── favicon.ico │ ├── logo.svg │ ├── pwa-192x192.png │ ├── pwa-512x512.png │ └── sw.js ├── pwaConfig.js ├── style │ ├── mobile │ │ ├── demo.less │ │ └── index.less │ ├── vars.less │ └── web │ │ └── index.less ├── test-coverage.js ├── vite.config.js └── web │ ├── App.jsx │ ├── Demo.jsx │ ├── components │ └── stackblitz │ │ ├── content.js │ │ └── index.jsx │ ├── main.jsx │ ├── site.config.js │ └── utils.js ├── src ├── _util │ ├── attachMethodsToComponent.ts │ ├── convertUnit.ts │ ├── delay.ts │ ├── dom.ts │ ├── formatNumber.ts │ ├── forwardRefWithStatics.ts │ ├── getContainer.ts │ ├── getScrollParent.ts │ ├── helper.ts │ ├── linearGradient.ts │ ├── nearest.ts │ ├── noop.ts │ ├── parseTNode.ts │ ├── renderToBody.ts │ ├── renderToContainer.ts │ ├── supportsPassive.ts │ ├── useClassName.ts │ ├── useColor.ts │ ├── useDefault.ts │ ├── useInitialized.ts │ ├── useShouldRender.ts │ ├── useSwipe.ts │ ├── useTouch.ts │ ├── withNativeProps.ts │ └── withStopPropagation.ts ├── action-sheet │ ├── ActionSheet.tsx │ ├── ActionSheetGrid.tsx │ ├── ActionSheetList.tsx │ ├── ActionSheetMethod.tsx │ ├── _example │ │ ├── align.tsx │ │ ├── grid-multiple.tsx │ │ ├── grid.tsx │ │ ├── index.tsx │ │ ├── list.tsx │ │ ├── status.tsx │ │ └── style │ │ │ └── index.less │ ├── action-sheet.en-US.md │ ├── action-sheet.md │ ├── defaultProps.ts │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── avatar │ ├── Avatar.tsx │ ├── AvatarGroup.tsx │ ├── AvatarGroupContext.tsx │ ├── _example │ │ ├── action.tsx │ │ ├── badgeAvatar.tsx │ │ ├── characterAvatar.tsx │ │ ├── exhibition.tsx │ │ ├── iconAvatar.tsx │ │ ├── imageAvatar.tsx │ │ ├── index.tsx │ │ ├── size.tsx │ │ └── style │ │ │ └── index.less │ ├── avatar-group.en-US.md │ ├── avatar-group.md │ ├── avatar.en-US.md │ ├── avatar.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── back-top │ ├── Backtop.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ └── style │ │ │ └── index.less │ ├── back-top.en-US.md │ ├── back-top.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── badge │ ├── Badge.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── size.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── badge.en-US.md │ ├── badge.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── button │ ├── Button.tsx │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── button.test.tsx.snap │ │ └── button.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── block.tsx │ │ ├── ghost.tsx │ │ ├── group.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── shape.tsx │ │ ├── size.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── test.tsx │ │ └── theme.tsx │ ├── button.en-US.md │ ├── button.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── calendar │ ├── Calendar.tsx │ ├── CalendarTemplate.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom-button.tsx │ │ ├── custom-range.tsx │ │ ├── custom-text.tsx │ │ ├── index.tsx │ │ ├── multiple.tsx │ │ ├── range.tsx │ │ ├── style │ │ │ └── index.less │ │ └── without-popup.tsx │ ├── calendar.en-US.md │ ├── calendar.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── cascader │ ├── Cascader.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── check-strictly.tsx │ │ ├── index.tsx │ │ ├── keys.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── theme-tab.tsx │ │ ├── with-title.tsx │ │ └── with-value.tsx │ ├── cascader.en-US.md │ ├── cascader.md │ ├── defaultProps.ts │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── cell │ ├── Cell.tsx │ ├── CellGroup.tsx │ ├── __tests__ │ │ └── cell.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── group.tsx │ │ ├── multiple.tsx │ │ ├── single.tsx │ │ └── style │ │ │ └── index.less │ ├── cell.en-US.md │ ├── cell.md │ ├── defaultProps.ts │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── checkbox │ ├── Checkbox.tsx │ ├── CheckboxGroup.tsx │ ├── _example │ │ ├── all.tsx │ │ ├── base.tsx │ │ ├── card.tsx │ │ ├── horizontal.tsx │ │ ├── index.tsx │ │ ├── right.tsx │ │ ├── special.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ └── type.tsx │ ├── checkbox-group.en-US.md │ ├── checkbox-group.md │ ├── checkbox.en-US.md │ ├── checkbox.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ ├── index.js │ │ └── index.less │ └── type.ts ├── collapse │ ├── Collapse.tsx │ ├── CollapseContext.tsx │ ├── CollapsePanel.tsx │ ├── _example │ │ ├── accordion.tsx │ │ ├── action.tsx │ │ ├── base.tsx │ │ ├── card.tsx │ │ ├── index.tsx │ │ └── placement.tsx │ ├── collapse.en-US.md │ ├── collapse.md │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── color-picker │ ├── ColorPicker.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── format.tsx │ │ ├── index.tsx │ │ ├── multiple.tsx │ │ ├── style │ │ │ └── index.less │ │ └── usePopup.tsx │ ├── color-picker.en-US.md │ ├── color-picker.md │ ├── constants.ts │ ├── defaultProps.ts │ ├── helper │ │ └── format.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── type.ts │ └── types.ts ├── common.ts ├── common │ └── Portal.tsx ├── config-provider │ ├── ConfigContext.tsx │ ├── ConfigProvider.tsx │ ├── _example │ │ ├── index.tsx │ │ ├── other-en.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── table-en.tsx │ │ └── upload-en.tsx │ ├── config-provider.en-US.md │ ├── config-provider.md │ ├── index.ts │ └── type.ts ├── count-down │ ├── CountDown.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── size.tsx │ │ └── style │ │ │ └── index.less │ ├── count-down.en-US.md │ ├── count-down.md │ ├── defaultProps.ts │ ├── hooks │ │ └── useCountDown │ │ │ ├── index.ts │ │ │ ├── transformTime.ts │ │ │ └── useCountDown.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── dialog │ ├── Dialog.tsx │ ├── _example │ │ ├── confirm.tsx │ │ ├── feedback.tsx │ │ ├── image-dialog.tsx │ │ ├── index.tsx │ │ ├── input.tsx │ │ ├── multi-state.tsx │ │ ├── plugin.tsx │ │ └── style │ │ │ └── index.less │ ├── alert.ts │ ├── confirm.ts │ ├── defaultProps.ts │ ├── dialog.en-US.md │ ├── dialog.md │ ├── index.ts │ ├── show.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── divider │ ├── Divider.tsx │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── vitest-divider.test.jsx.snap │ │ ├── divider.test.tsx │ │ └── vitest-divider.test.jsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── divider.en-US.md │ ├── divider.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── drawer │ ├── Drawer.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── footer.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── plugin.tsx │ │ ├── style │ │ │ └── index.less │ │ └── title.tsx │ ├── defaultProps.ts │ ├── drawer.en-US.md │ ├── drawer.md │ ├── index.ts │ ├── plugin.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── dropdown-menu │ ├── DropdownItem.tsx │ ├── DropdownMenu.tsx │ ├── DropdownMenuContext.ts │ ├── _example │ │ ├── customized.tsx │ │ ├── direction.tsx │ │ ├── disabled.tsx │ │ ├── index.tsx │ │ ├── multiple.tsx │ │ ├── single.tsx │ │ └── style │ │ │ └── customized.less │ ├── defaultProps.ts │ ├── dropdown-menu.en-US.md │ ├── dropdown-menu.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── empty │ ├── Empty.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── buttonEmpty.tsx │ │ ├── imageEmpty.tsx │ │ ├── index.tsx │ │ └── style │ │ │ └── index.less │ ├── empty.en-US.md │ ├── empty.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── fab │ ├── Fab.tsx │ ├── _example │ │ ├── advance.tsx │ │ ├── base.tsx │ │ ├── index.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── fab.en-US.md │ ├── fab.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── grid │ ├── Grid.tsx │ ├── GridContext.tsx │ ├── GridItem.tsx │ ├── __tests__ │ │ └── index.test.tsx │ ├── _example │ │ ├── badge.tsx │ │ ├── base.tsx │ │ ├── bordered.tsx │ │ ├── card.tsx │ │ ├── desc.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── scroll.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── grid.en-US.md │ ├── grid.md │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── guide │ ├── Guide.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom-popover.tsx │ │ ├── dialog-body.tsx │ │ ├── dialog.tsx │ │ ├── index.tsx │ │ ├── my-popover.tsx │ │ ├── no-mask.tsx │ │ ├── popover-dialog.tsx │ │ └── style │ │ │ ├── dialog-body.less │ │ │ ├── index.less │ │ │ └── my-popover.less │ ├── defaultProps.ts │ ├── guide.en-US.md │ ├── guide.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── type.ts │ └── utils │ │ ├── dom.ts │ │ ├── index.ts │ │ └── shared.ts ├── hooks │ ├── useClass.ts │ ├── useConfig.ts │ ├── useControlled.ts │ ├── useDefaultProps.ts │ ├── useHover.ts │ ├── useLayoutEffect.ts │ ├── useLockScroll.ts │ └── useSetState.ts ├── icon │ ├── _example │ │ ├── base.tsx │ │ ├── enhanced.tsx │ │ ├── iconfont-enhanced.tsx │ │ ├── iconfont.tsx │ │ ├── index.tsx │ │ ├── single.tsx │ │ └── style │ │ │ └── index.less │ ├── icon.en-US.md │ ├── icon.md │ └── type.ts ├── image-viewer │ ├── _example │ │ ├── align.tsx │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── operation.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── getFixScaleEleTransPosition.ts │ ├── image-viewer.en-US.md │ ├── image-viewer.md │ ├── image-viewer.tsx │ ├── index.ts │ ├── raf.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── transform.ts │ ├── type.ts │ ├── useTouchEvent.ts │ └── util.ts ├── image │ ├── Image.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── position.tsx │ │ ├── shape.tsx │ │ ├── status.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── image.en-US.md │ ├── image.md │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── index-lib.ts ├── index.ts ├── indexes │ ├── Indexes.tsx │ ├── IndexesAnchor.tsx │ ├── IndexesContext.tsx │ ├── __tests__ │ │ └── index.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom.tsx │ │ ├── index.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.tsx │ ├── indexes.en-US.md │ ├── indexes.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── input │ ├── Input.tsx │ ├── _example │ │ ├── align.tsx │ │ ├── banner.tsx │ │ ├── base.tsx │ │ ├── bordered.tsx │ │ ├── custom.tsx │ │ ├── index.tsx │ │ ├── label.tsx │ │ ├── layout.tsx │ │ ├── maxLength.tsx │ │ ├── prefix.tsx │ │ ├── special.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ └── suffix.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── input.en-US.md │ ├── input.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── layout │ ├── Col.tsx │ ├── Row.tsx │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── demo.test.jsx.snap │ │ │ └── demo.test.tsx.snap │ │ ├── demo.test.tsx │ │ └── index.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── offset.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── layout.en-US.md │ ├── layout.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── link │ ├── Link.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── linkSize.tsx │ │ ├── prefix.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── suffix.tsx │ │ ├── theme.tsx │ │ └── underline.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── link.en-US.md │ ├── link.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── list │ ├── _example │ │ ├── base.tsx │ │ ├── err-tip.tsx │ │ ├── index.tsx │ │ ├── pull-refresh.tsx │ │ └── style │ │ │ └── index.less │ ├── index.ts │ ├── list.en-US.md │ ├── list.md │ ├── list.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── loading │ ├── Loading.tsx │ ├── _example │ │ ├── attach.tsx │ │ ├── base.tsx │ │ ├── delay.tsx │ │ ├── fullscreen.tsx │ │ ├── horz.tsx │ │ ├── index.tsx │ │ ├── pure-text.tsx │ │ ├── service.tsx │ │ ├── size.tsx │ │ ├── speed.tsx │ │ ├── style │ │ │ └── index.less │ │ └── vert.tsx │ ├── defaultProps.ts │ ├── icon │ │ ├── Gradient.tsx │ │ └── Spinner.tsx │ ├── index.ts │ ├── loading.en-US.md │ ├── loading.md │ ├── plugin.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── locale │ ├── LocalReceiver.ts │ ├── ar_KW.ts │ ├── en_US.ts │ ├── it_IT.ts │ ├── ja_JP.ts │ ├── ko_KR.ts │ ├── ru_RU.ts │ ├── zh_CN.ts │ └── zh_TW.ts ├── message │ ├── Message.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── close-all.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── hooks │ │ └── useMessageCssTransition.ts │ ├── index.tsx │ ├── message.en-US.md │ ├── message.md │ ├── methods.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── navbar │ ├── Navbar.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom-color.tsx │ │ ├── img.tsx │ │ ├── index.tsx │ │ ├── left-title.tsx │ │ ├── search.tsx │ │ ├── size.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── navbar.en-US.md │ ├── navbar.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── notice-bar │ ├── NoticeBar.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom.tsx │ │ ├── customization.tsx │ │ ├── event.tsx │ │ ├── iconDemo.tsx │ │ ├── mobile.tsx │ │ ├── scrolling.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── suffixIcon.tsx │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── notice-bar.en-US.md │ ├── notice-bar.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── overlay │ ├── Overlay.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.tsx │ ├── overlay.en-US.md │ ├── overlay.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── picker │ ├── Picker.tsx │ ├── PickerItem.tsx │ ├── PickerView.tsx │ ├── _example │ │ ├── base.jsx │ │ ├── index.jsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── picker-context.ts │ ├── picker.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── popover │ ├── Popover.tsx │ ├── _example │ │ ├── index.tsx │ │ ├── placement.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── theme.tsx │ │ └── type.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── popover.en-US.md │ ├── popover.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── popup │ ├── Popup.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom-close.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ └── index.less │ │ └── with-title.tsx │ ├── defaultProps.ts │ ├── index.tsx │ ├── popup.en-US.md │ ├── popup.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── progress │ ├── Progress.tsx │ ├── __tests__ │ │ └── progress.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── circle.tsx │ │ ├── custom.tsx │ │ ├── index.tsx │ │ ├── line.tsx │ │ ├── plump.tsx │ │ ├── style │ │ │ └── index.less │ │ └── transition.tsx │ ├── constants.ts │ ├── defaultProps.ts │ ├── index.tsx │ ├── progress.en-US.md │ ├── progress.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── pull-down-refresh │ ├── PullDownRefresh.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── loading-texts.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── timeout.tsx │ │ └── top.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── pull-down-refresh.en-US.md │ ├── pull-down-refresh.md │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── type.ts │ └── useTouch.ts ├── radio │ ├── Radio.tsx │ ├── RadioGroup.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── card.tsx │ │ ├── custom.tsx │ │ ├── horizontal.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── placement.tsx │ │ ├── status.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── radio.en-US.md │ ├── radio.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── rate │ ├── Rate.tsx │ ├── RateIcon.tsx │ ├── RateText.tsx │ ├── RateTips.tsx │ ├── _example │ │ ├── action.tsx │ │ ├── base.tsx │ │ ├── color.tsx │ │ ├── count.tsx │ │ ├── custom.tsx │ │ ├── index.tsx │ │ ├── placement.tsx │ │ ├── show-text.tsx │ │ ├── size.tsx │ │ ├── special.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── rate.en-US.md │ ├── rate.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── result │ ├── Result.tsx │ ├── _example │ │ ├── custom.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── result.en-US.md │ ├── result.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── search │ ├── Search.tsx │ ├── _example │ │ ├── action.tsx │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── other.tsx │ │ ├── shape.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── search.en-US.md │ ├── search.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── side-bar │ ├── SideBar.tsx │ ├── SideBarContext.tsx │ ├── SideBarItem.tsx │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── side-bar.test.tsx.snap │ │ └── side-bar.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── custom.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ ├── base.less │ │ │ ├── custom.less │ │ │ ├── index.less │ │ │ └── switch.less │ │ ├── switch.tsx │ │ └── with-icon.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── side-bar.en-US.md │ ├── side-bar.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── skeleton │ ├── Skeleton.tsx │ ├── _example │ │ ├── animation.tsx │ │ ├── cell-group.tsx │ │ ├── grid.tsx │ │ ├── image-group.tsx │ │ ├── index.jsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── skeleton.en-US.md │ ├── skeleton.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── slider │ ├── Slider.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── capsule.tsx │ │ ├── disabled.tsx │ │ ├── index.tsx │ │ ├── label.tsx │ │ ├── range.tsx │ │ ├── step.tsx │ │ └── style │ │ │ └── index.less │ ├── constants.ts │ ├── defaultProps.ts │ ├── index.tsx │ ├── slider.en-US.md │ ├── slider.md │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── type.ts │ └── utils │ │ └── index.ts ├── stepper │ ├── Stepper.tsx │ ├── __tests__ │ │ └── index.test.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── min-max.tsx │ │ ├── size.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── defaultProps.ts │ ├── index.tsx │ ├── stepper.en-US.md │ ├── stepper.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── steps │ ├── StepItem.tsx │ ├── Steps.tsx │ ├── StepsContext.tsx │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── demo.test.tsx.snap │ │ ├── demo.test.tsx │ │ └── index.test.tsx │ ├── _example │ │ ├── horizontal.tsx │ │ ├── index.tsx │ │ ├── special.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ └── vertical.tsx │ ├── defaultProps.ts │ ├── index.tsx │ ├── steps.en-US.md │ ├── steps.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── sticky │ ├── Sticky.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── container.tsx │ │ ├── index.tsx │ │ ├── offset.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── hooks │ │ └── useBoundingClientRect.ts │ ├── index.tsx │ ├── sticky.en-US.md │ ├── sticky.md │ ├── style │ │ ├── css.js │ │ └── index.js │ └── type.ts ├── style │ ├── css.js │ └── index.js ├── swipe-cell │ ├── SwipeCell.tsx │ ├── _example │ │ ├── double.tsx │ │ ├── event.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── left.tsx │ │ ├── right.tsx │ │ └── style │ │ │ └── base.less │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ ├── index.js │ │ └── index.less │ ├── swipe-cell.en-US.md │ ├── swipe-cell.md │ └── type.ts ├── swiper │ ├── Swiper.tsx │ ├── SwiperContext.tsx │ ├── SwiperItem.tsx │ ├── _example │ │ ├── animation.tsx │ │ ├── base.tsx │ │ ├── card.tsx │ │ ├── control.tsx │ │ ├── current.tsx │ │ ├── custom.tsx │ │ ├── direction.tsx │ │ ├── fraction.tsx │ │ ├── index.tsx │ │ ├── outside.tsx │ │ ├── pagination-type.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── test.tsx │ │ └── vertical.tsx │ ├── defaultProps.ts │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── swiper.en-US.md │ ├── swiper.md │ └── type.ts ├── switch │ ├── Switch.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── color.tsx │ │ ├── index.tsx │ │ ├── label.tsx │ │ ├── size.tsx │ │ ├── status.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── switch.en-US.md │ ├── switch.md │ └── type.ts ├── tab-bar │ ├── TabBar.tsx │ ├── TabBarContext.tsx │ ├── TabBarItem.tsx │ ├── _example │ │ ├── badge-props.tsx │ │ ├── base.tsx │ │ ├── custom.tsx │ │ ├── mobile.tsx │ │ ├── pure-icon.tsx │ │ ├── round.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── text-spread.tsx │ │ └── text.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── tab-bar.en-US.md │ ├── tab-bar.md │ ├── type.ts │ └── useTabBarCssTransition.ts ├── table │ ├── BaseTable.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── bordered.tsx │ │ ├── index.tsx │ │ ├── scroll.tsx │ │ └── stripe.tsx │ ├── defaultProps.ts │ ├── hooks │ │ ├── useClassName.ts │ │ └── useStyle.ts │ ├── index.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── table.en-US.md │ ├── table.md │ └── type.ts ├── tabs │ ├── TabPanel.tsx │ ├── Tabs.tsx │ ├── _example │ │ ├── badge.tsx │ │ ├── content.tsx │ │ ├── evenly.tsx │ │ ├── icon.tsx │ │ ├── index.tsx │ │ ├── isometric.tsx │ │ ├── size.tsx │ │ ├── status.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── context.ts │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── tabs.en-US.md │ ├── tabs.md │ └── type.ts ├── tag │ ├── CheckTag.tsx │ ├── Tag.tsx │ ├── __tests__ │ │ └── index.test.tsx │ ├── _example │ │ ├── checkable.tsx │ │ ├── closable.tsx │ │ ├── index.tsx │ │ ├── size.tsx │ │ ├── style │ │ │ └── index.less │ │ ├── theme.tsx │ │ └── type.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── tag.en-US.md │ ├── tag.md │ └── type.ts ├── textarea │ ├── Textarea.tsx │ ├── _example │ │ ├── autosize.tsx │ │ ├── base.tsx │ │ ├── card.tsx │ │ ├── custom.tsx │ │ ├── disable.tsx │ │ ├── index.tsx │ │ ├── label.tsx │ │ ├── maxcharacter.tsx │ │ ├── maxlength.tsx │ │ └── style │ │ │ └── index.less │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── textarea.en-US.md │ ├── textarea.md │ └── type.ts ├── toast │ ├── Toast.tsx │ ├── _example │ │ ├── base.tsx │ │ ├── close.tsx │ │ ├── cover.tsx │ │ ├── index.tsx │ │ ├── style │ │ │ └── index.less │ │ └── theme.tsx │ ├── constant.ts │ ├── defaultProps.ts │ ├── hooks │ │ └── useMessageCssTransition.ts │ ├── index.ts │ ├── methods.tsx │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── toast.en-US.md │ ├── toast.md │ └── type.ts ├── tree-select │ ├── _example │ │ ├── base.tsx │ │ ├── index.tsx │ │ ├── multiple.tsx │ │ └── normal.tsx │ ├── defaultProps.ts │ ├── index.ts │ ├── style │ │ ├── css.js │ │ └── index.js │ ├── tree-select.en-US.md │ ├── tree-select.md │ ├── tree-select.tsx │ └── type.ts └── upload │ ├── Upload.tsx │ ├── _example │ ├── base.jsx │ ├── index.jsx │ ├── multiple.jsx │ └── style │ │ └── index.less │ ├── index.ts │ ├── style │ ├── css.js │ └── index.js │ ├── type.ts │ ├── types.ts │ ├── upload.md │ └── util.ts ├── test ├── README.md ├── config │ ├── cypress.json │ ├── jest.base.conf.js │ ├── jest.ssr.conf.js │ └── jest.unit.conf.js ├── scripts │ └── setup-framework.js ├── snap │ ├── __snapshots__ │ │ ├── csr.test.jsx.snap │ │ └── ssr.test.jsx.snap │ ├── csr.test.jsx │ └── ssr.test.jsx └── utils │ └── index.ts ├── tsconfig.build.json ├── tsconfig.json └── vitest.config.mts /.eslintignore: -------------------------------------------------------------------------------- 1 | snapshot* 2 | dist/ 3 | esm/ 4 | lib/ 5 | cjs/ 6 | lib/ 7 | es/ 8 | node_modules/ 9 | static 10 | cypress 11 | script/test/cypress 12 | _site 13 | temp* 14 | static/ 15 | src/_common 16 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @anlyyao @ZWkang @jarmywang 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: 使用 issue-helper 新建 4 | url: https://Tencent.github.io/tdesign/issue-helper/?lang=zh-CN&repo=Tencent/tdesign-mobile-react 5 | about: 使用 https://Tencent.github.io/tdesign/issue-helper/ 创建 issue,其中包含 bug 和 feature,表单提交更加严格。 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Basic dependabot.yml file with 2 | # minimum configuration for two package managers 3 | 4 | version: 2 5 | updates: 6 | # Enable version updates for npm 7 | - package-ecosystem: 'npm' 8 | # Look for `package.json` and `lock` files in the `root` directory 9 | directory: '/' 10 | # Check the npm registry for updates every day (weekdays) 11 | schedule: 12 | interval: 'monthly' 13 | 14 | # Enable version updates for Docker 15 | - package-ecosystem: 'docker' 16 | # Look for a `Dockerfile` in the `root` directory 17 | directory: '/' 18 | # Check for updates once a week 19 | schedule: 20 | interval: 'monthly' 21 | -------------------------------------------------------------------------------- /.github/issue-shoot.md: -------------------------------------------------------------------------------- 1 | ## IssueShoot 2 | - 预估时长: {{ .duration }} 3 | - 期望完成时间: {{ .deadline }} 4 | - 开发难度: {{ .level }} 5 | - 参与人数: 1 6 | - 需求对接人: anlyyao 7 | - 验收标准: 实现期望改造效果,提 PR 并通过验收无误 8 | - 备注: 最终激励以实际提交 `pull request` 并合并为准 9 | -------------------------------------------------------------------------------- /.github/workflows/issue-help-wanted.temp.yml: -------------------------------------------------------------------------------- 1 | # force copy from tencent/tdesign 2 | name: Issue Help wanted 3 | on: 4 | issues: 5 | types: 6 | - labeled 7 | jobs: 8 | add-comment: 9 | if: github.event.label.name == 'help wanted' 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: write 13 | steps: 14 | - name: Add comment 15 | uses: peter-evans/create-or-update-comment@v1 16 | with: 17 | issue-number: ${{ github.event.issue.number }} 18 | body: | 19 | 任何人都可以处理此问题。 20 | **请务必在您的 `pull request` 中引用此问题。** :sparkles: 21 | 感谢你的贡献! :sparkles: 22 | reactions: heart -------------------------------------------------------------------------------- /.github/workflows/issue-mark-duplicate.temp.yml: -------------------------------------------------------------------------------- 1 | # force copy from tencent/tdesign 2 | # 当在 issue 的 comment 回复类似 `Duplicate of #111` 这样的话,issue 将被自动打上 重复提交标签 并且 cloese 3 | name: Issue Mark Duplicate 4 | 5 | on: 6 | issue_comment: 7 | types: [created, edited] 8 | 9 | jobs: 10 | mark-duplicate: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: mark-duplicate 14 | uses: actions-cool/issues-helper@v2 15 | with: 16 | actions: "mark-duplicate" 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | duplicate-labels: "duplicate" 19 | close-issue: true 20 | -------------------------------------------------------------------------------- /.github/workflows/issue-reply.temp.yml: -------------------------------------------------------------------------------- 1 | # force copy from tencent/tdesign 2 | # 当被打上 Need Reproduce 标签时候,自动提示需要重现实例 3 | 4 | name: ISSUE_REPLY 5 | 6 | on: 7 | issues: 8 | types: [labeled] 9 | 10 | jobs: 11 | issue-reply: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Need Reproduce 15 | if: github.event.label.name == 'Need Reproduce' 16 | uses: actions-cool/issues-helper@v2 17 | with: 18 | actions: 'create-comment' 19 | issue-number: ${{ github.event.issue.number }} 20 | body: | 21 | 你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。 22 | -------------------------------------------------------------------------------- /.github/workflows/issue-synchronize.temp.yml: -------------------------------------------------------------------------------- 1 | # force copy from tencent/tdesign 2 | name: Issue Synchronize 3 | 4 | on: 5 | issues: 6 | types: [opened, reopened] 7 | 8 | jobs: 9 | synchronize: 10 | runs-on: ubuntu-latest 11 | steps: 12 | # https://docs.github.com/cn/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues 13 | - uses: 94dreamer/create-report@main 14 | with: 15 | wxhook: ${{ secrets.WX_HOOK_URL }} 16 | token: ${{ secrets.GITHUB_TOKEN }} 17 | type: 'issue' -------------------------------------------------------------------------------- /.github/workflows/pkg-pr-new.yml: -------------------------------------------------------------------------------- 1 | name: Publish_Any_Commit 2 | on: 3 | push: 4 | branches: [develop] 5 | pull_request: 6 | branches: [develop] 7 | 8 | jobs: 9 | build: 10 | if: ${{ github.repository == 'Tencent/tdesign-mobile-react' && !startsWith(github.head_ref, 'release/') }} 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | submodules: recursive 17 | 18 | - uses: actions/setup-node@v4 19 | with: 20 | node-version: 18 21 | 22 | - run: npm install 23 | 24 | - run: npm run build 25 | 26 | - run: npx pkg-pr-new publish --compact 27 | -------------------------------------------------------------------------------- /.github/workflows/pr-compressed-size.yml: -------------------------------------------------------------------------------- 1 | name: Compressed Size 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize] 6 | 7 | jobs: 8 | compressed-size: 9 | runs-on: ubuntu-latest 10 | if: startsWith(github.head_ref, 'release/') 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | submodules: recursive 15 | - uses: 94dreamer/compressed-size-action@master 16 | with: 17 | repo-token: '${{ secrets.GITHUB_TOKEN }}' 18 | pattern: './dist/**/*.{js,css}' 19 | -------------------------------------------------------------------------------- /.github/workflows/pr-spelling.template.yml: -------------------------------------------------------------------------------- 1 | name: pr-spell-check 2 | on: [pull_request] 3 | 4 | jobs: 5 | run: 6 | name: Spell Check with Typos 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Check spelling 11 | uses: crate-ci/typos@master 12 | with: 13 | config: .github/workflows/typos-config.toml 14 | -------------------------------------------------------------------------------- /.github/workflows/preview-publish.yml: -------------------------------------------------------------------------------- 1 | # 文件名建议统一为 preview-publish 2 | # 应用 preview.yml 的 demo 3 | name: PREVIEW_PUBLISH 4 | 5 | on: 6 | workflow_run: 7 | workflows: ["MAIN_PULL_REQUEST"] 8 | types: 9 | - completed 10 | 11 | jobs: 12 | call-preview: 13 | uses: Tencent/tdesign/.github/workflows/preview.yml@main 14 | secrets: 15 | TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/pull-request.yml: -------------------------------------------------------------------------------- 1 | # 文件名建议统一为 pull-request.yml 2 | # 应用 test-build.yml 的 demo 3 | 4 | name: MAIN_PULL_REQUEST 5 | 6 | on: 7 | pull_request: 8 | branches: [develop, main] 9 | types: [opened, synchronize, reopened] 10 | 11 | jobs: 12 | call-test-build: 13 | uses: Tencent/tdesign/.github/workflows/test-build.yml@main -------------------------------------------------------------------------------- /.github/workflows/tag-push.yml: -------------------------------------------------------------------------------- 1 | # 文件名建议统一为 tag-push.yml 2 | # 应用 publish.yml 的 demo 3 | 4 | name: TAG_PUSH 5 | 6 | on: create 7 | 8 | jobs: 9 | call-publish: 10 | uses: Tencent/tdesign/.github/workflows/publish.yml@main 11 | secrets: 12 | TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} 13 | TDESIGN_NPM_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }} 14 | PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} 15 | -------------------------------------------------------------------------------- /.github/workflows/typos-config.toml: -------------------------------------------------------------------------------- 1 | default.check-filename = true 2 | 3 | [default.extend-words] 4 | actived = "actived" 5 | colum = "colum" 6 | 7 | [files] 8 | extend-exclude = ["CHANGELOG.md", "*.snap", "test/config/jest.base.conf.js"] 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | .idea 5 | es 6 | lib 7 | dist 8 | esm 9 | cjs 10 | _site/ 11 | temp* 12 | .gitlogmap 13 | yarn.lock 14 | package-lock.json 15 | pnpm-lock.yaml 16 | robotMsg.json -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/_common"] 2 | path = src/_common 3 | url = https://github.com/Tencent/tdesign-common.git 4 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit "" 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged && log_emails=$(git config user.email) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo 本地提交邮箱 $log_emails 校验非法,需要本地更改重新提交 && exit 2;else echo 邮箱 $log_emails 校验通过;fi 5 | -------------------------------------------------------------------------------- /.husky/prepare-commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [[ "$(uname -a)" = *"MINGW64"* ]] && exit 0 3 | [ -n "$CI" ] && exit 0 4 | . "$(dirname "$0")/_/husky.sh" 5 | 6 | exec < /dev/tty && npx git-cz --hook || true -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], 3 | plugins: ['@babel/plugin-transform-runtime'], 4 | }; 5 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {extends: ['@commitlint/config-conventional']} 2 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | const plugins = [ 2 | require('autoprefixer'), 3 | // require('cssnano')({ 4 | // preset: [ 5 | // 'default', 6 | // { 7 | // discardComments: { 8 | // removeAll: true, 9 | // }, 10 | // }, 11 | // ], 12 | // }), 13 | ]; 14 | 15 | module.exports = { 16 | plugins, 17 | }; 18 | -------------------------------------------------------------------------------- /site/.env.intranet: -------------------------------------------------------------------------------- 1 | NODE_ENV=production -------------------------------------------------------------------------------- /site/mobile/components/DemoHeader.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import '../../style/mobile/index.less'; 3 | 4 | const TDemoHeader = (prop) => { 5 | const { title, summary } = prop; 6 | return ( 7 | <> 8 |
9 |

{title}

10 |

{summary}

11 |
12 | 13 | ); 14 | }; 15 | 16 | export default TDemoHeader; 17 | -------------------------------------------------------------------------------- /site/mobile/components/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-demo-block { 2 | & + &__summary { 3 | padding-top: 16px; 4 | } 5 | } 6 | 7 | #app { 8 | min-height: 100vh; 9 | height: 100vh; 10 | display: flex; 11 | flex-direction: column; 12 | } 13 | 14 | .tdesign-mobile-demo { 15 | flex: 1; 16 | overflow-y: scroll; 17 | } -------------------------------------------------------------------------------- /site/mobile/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import '../style/mobile/index.less'; 5 | 6 | import '../../src/_common/style/mobile/_reset.less'; 7 | // import '../../src/_common/style/mobile/index.less'; 8 | 9 | ReactDOM.render( 10 | 11 | 12 | , 13 | document.getElementById('app'), 14 | ); 15 | -------------------------------------------------------------------------------- /site/mobile/utils.js: -------------------------------------------------------------------------------- 1 | export function getRoute(list, docRoutes) { 2 | list.forEach((item) => { 3 | if (item.children) { 4 | return getRoute(item.children, docRoutes); 5 | } 6 | return docRoutes.push({ 7 | ...item, 8 | path: `/${item.name}` 9 | }); 10 | }); 11 | return docRoutes; 12 | } 13 | 14 | export function getCurrentRoute(docRoutes, name) { 15 | const currentRoutes = docRoutes?.filter(item => item.name === name) || []; 16 | return currentRoutes.length > 0 ? currentRoutes[0] : {}; 17 | } 18 | -------------------------------------------------------------------------------- /site/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/site/public/apple-touch-icon.png -------------------------------------------------------------------------------- /site/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/site/public/favicon.ico -------------------------------------------------------------------------------- /site/public/pwa-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/site/public/pwa-192x192.png -------------------------------------------------------------------------------- /site/public/pwa-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/site/public/pwa-512x512.png -------------------------------------------------------------------------------- /site/public/sw.js: -------------------------------------------------------------------------------- 1 | import { precacheAndRoute } from 'workbox-precaching' 2 | 3 | precacheAndRoute(self.__WB_MANIFEST) 4 | 5 | self.addEventListener('message', (event) => { 6 | if (event.data && event.data.type === 'SKIP_WAITING') 7 | self.skipWaiting() 8 | }); 9 | -------------------------------------------------------------------------------- /site/pwaConfig.js: -------------------------------------------------------------------------------- 1 | export default { 2 | strategies: 'injectManifest', 3 | includeAssets: ['favicon.svg', 'favicon.ico', 'apple-touch-icon.png'], 4 | injectManifest: { 5 | maximumFileSizeToCacheInBytes: 7000000, 6 | }, 7 | manifest: { 8 | name: 'TDesign for Mobile React', 9 | short_name: 'TDesign', 10 | description: 'React UI Component', 11 | theme_color: '#ffffff', 12 | icons: [ 13 | { 14 | src: 'pwa-192x192.png', 15 | sizes: '192x192', 16 | type: 'image/png', 17 | }, 18 | { 19 | src: 'pwa-512x512.png', 20 | sizes: '512x512', 21 | type: 'image/png', 22 | }, 23 | ], 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /site/style/web/index.less: -------------------------------------------------------------------------------- 1 | div[slot='action'] { 2 | display: inline-flex; 3 | column-gap: 8px; 4 | } 5 | 6 | .action-online { 7 | width: 32px; 8 | height: 32px; 9 | box-sizing: border-box; 10 | display: inline-flex; 11 | align-items: center; 12 | justify-content: center; 13 | padding: 8px; 14 | transition: all 0.2s linear; 15 | cursor: pointer; 16 | border-radius: 3px; 17 | color: var(--text-secondary); 18 | 19 | &:hover { 20 | color: var(--text-primary); 21 | background-color: var(--bg-color-demo-hover, rgb(243, 243, 243)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /site/test-coverage.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | button: { statements: '100%', branches: '66.66%', functions: '100%', lines: '100%' }, 3 | configProvider: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' }, 4 | hooks: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' }, 5 | progress: { statements: '84.37%', branches: '56.75%', functions: '85.71%', lines: '85.48%' }, 6 | }; 7 | -------------------------------------------------------------------------------- /site/web/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | 4 | import { registerLocaleChange } from 'tdesign-site-components'; 5 | import 'tdesign-site-components/lib/styles/prism-theme-dark.less'; 6 | import 'tdesign-site-components/lib/styles/prism-theme.less'; 7 | import 'tdesign-site-components/lib/styles/style.css'; 8 | 9 | import 'tdesign-icons-view'; 10 | import 'tdesign-theme-generator'; 11 | 12 | import App from './App'; 13 | import '../style/web/index.less'; 14 | 15 | registerLocaleChange(); 16 | ReactDOM.render( 17 | 18 | 19 | , 20 | document.getElementById('app'), 21 | ); 22 | -------------------------------------------------------------------------------- /src/_util/attachMethodsToComponent.ts: -------------------------------------------------------------------------------- 1 | export function attachMethodsToComponent(component: any, methods: any) { 2 | const comp = component; 3 | // eslint-disable-next-line guard-for-in 4 | for (const method in methods) { 5 | comp[method] = methods[method]; 6 | } 7 | return comp; 8 | } 9 | -------------------------------------------------------------------------------- /src/_util/convertUnit.ts: -------------------------------------------------------------------------------- 1 | import { isNumber } from 'lodash-es'; 2 | 3 | export const convertUnit = (val: string | number | undefined) => { 4 | if (val == null) return 0; 5 | return isNumber(val) ? `${val}px` : val; 6 | }; 7 | 8 | export const reconvertUnit = (val: string | number | undefined) => { 9 | if (val == null) return 0; 10 | return isNumber(val) ? Number(val) : Number(val.slice(0, -2)); 11 | }; 12 | -------------------------------------------------------------------------------- /src/_util/delay.ts: -------------------------------------------------------------------------------- 1 | export default function delay(time: number) { 2 | return new Promise((resolve) => { 3 | setTimeout(resolve, time); 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /src/_util/dom.ts: -------------------------------------------------------------------------------- 1 | // 用于判断是否可使用 dom 2 | export const canUseDocument = !!(typeof window !== 'undefined' && window.document && window.document.createElement); 3 | -------------------------------------------------------------------------------- /src/_util/forwardRefWithStatics.ts: -------------------------------------------------------------------------------- 1 | import React, { RefAttributes, forwardRef } from 'react'; 2 | import hoistNonReactStatics from 'hoist-non-react-statics'; 3 | 4 | export default function forwardRefWithStatics( 5 | component: React.ForwardRefRenderFunction, 6 | statics?: S, 7 | ): React.FunctionComponent

> & S { 8 | return hoistNonReactStatics(forwardRef(component), statics as any) as any; 9 | } 10 | -------------------------------------------------------------------------------- /src/_util/getContainer.ts: -------------------------------------------------------------------------------- 1 | import { isFunction, isString } from 'lodash-es'; 2 | 3 | import { ScrollContainerElement, ScrollContainer } from '../common'; 4 | 5 | export function resolveContainer(getContainer: ScrollContainerElement | ScrollContainer): ScrollContainerElement { 6 | if (isString(getContainer)) { 7 | return getContainer ? (document.querySelector(getContainer) as HTMLElement) : window; 8 | } 9 | if (isFunction(getContainer)) { 10 | return getContainer(); 11 | } 12 | return getContainer; 13 | } 14 | -------------------------------------------------------------------------------- /src/_util/getScrollParent.ts: -------------------------------------------------------------------------------- 1 | type ScrollElement = HTMLElement | Window; 2 | 3 | const overflowScrollReg = /scroll|auto|overlay/i; 4 | 5 | export default function getScrollParent( 6 | el: Element | null | undefined, 7 | root: ScrollElement | null | undefined = window, 8 | ): Window | Element | null | undefined { 9 | let node = el; 10 | 11 | while (node && node !== root && node.nodeType === 1) { 12 | const { overflowY } = window.getComputedStyle(node); 13 | if (overflowScrollReg.test(overflowY)) { 14 | return node; 15 | } 16 | node = node.parentNode as Element; 17 | } 18 | 19 | return root; 20 | } 21 | -------------------------------------------------------------------------------- /src/_util/noop.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-empty-function 2 | export default () => {}; 3 | -------------------------------------------------------------------------------- /src/_util/renderToBody.ts: -------------------------------------------------------------------------------- 1 | import ReactDOM from 'react-dom'; 2 | import { ReactElement } from 'react'; 3 | 4 | export function renderToBody(element: ReactElement) { 5 | const container = document.createElement('div'); 6 | document.body.appendChild(container); 7 | function unmount() { 8 | const unmountResult = ReactDOM.unmountComponentAtNode(container); 9 | if (unmountResult && container.parentNode) { 10 | container.parentNode.removeChild(container); 11 | } 12 | } 13 | ReactDOM.render(element, container); 14 | return unmount; 15 | } 16 | 17 | export default renderToBody; 18 | -------------------------------------------------------------------------------- /src/_util/renderToContainer.ts: -------------------------------------------------------------------------------- 1 | import { createPortal } from 'react-dom'; 2 | import { ReactElement, ReactPortal } from 'react'; 3 | import { resolveContainer } from './getContainer'; 4 | import { canUseDocument } from './dom'; 5 | 6 | export type GetContainer = HTMLElement | (() => HTMLElement) | null; 7 | 8 | export function renderToContainer(getContainer: GetContainer, node: ReactElement) { 9 | if (canUseDocument && getContainer) { 10 | const container = resolveContainer(getContainer); 11 | return createPortal(node, container as Element) as ReactPortal; 12 | } 13 | return node; 14 | } 15 | -------------------------------------------------------------------------------- /src/_util/supportsPassive.ts: -------------------------------------------------------------------------------- 1 | import { canUseDocument } from './dom'; 2 | 3 | // eslint-disable-next-line 4 | export let supportsPassive = false; 5 | 6 | if (canUseDocument) { 7 | try { 8 | const opts = {}; 9 | Object.defineProperty(opts, 'passive', { 10 | get() { 11 | supportsPassive = true; 12 | }, 13 | }); 14 | window.addEventListener('test-passive', null as any, opts); 15 | } catch (e) { 16 | // 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/_util/useClassName.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/src/_util/useClassName.ts -------------------------------------------------------------------------------- /src/_util/useColor.ts: -------------------------------------------------------------------------------- 1 | export const useColor = ( 2 | color: string | string[], 3 | defaultCheckColor: string = null, 4 | defaultUnCheckColor: string = null, 5 | ): string[] => { 6 | const tmpColor = color instanceof Array ? color : [color]; 7 | const [checkColor = defaultCheckColor, unCheckColor = defaultUnCheckColor] = tmpColor; 8 | return [checkColor, unCheckColor]; 9 | }; 10 | 11 | export default useColor; 12 | -------------------------------------------------------------------------------- /src/_util/useInitialized.ts: -------------------------------------------------------------------------------- 1 | import { useRef } from 'react'; 2 | 3 | export function useInitialized(check?: boolean) { 4 | const initializedRef = useRef(check); 5 | if (check) { 6 | initializedRef.current = true; 7 | } 8 | return !!initializedRef.current; 9 | } 10 | -------------------------------------------------------------------------------- /src/action-sheet/ActionSheetMethod.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderToBody from '../_util/renderToBody'; 3 | import ActionSheet from './ActionSheet'; 4 | import type { ActionSheetProps } from './ActionSheet'; 5 | import { actionSheetDefaultProps } from './defaultProps'; 6 | 7 | let destroyRef: () => void; 8 | 9 | export function show(config: Partial) { 10 | destroyRef?.(); 11 | 12 | const app = document.createElement('div'); 13 | 14 | document.body.appendChild(app); 15 | 16 | destroyRef = renderToBody(); 17 | } 18 | 19 | export function close() { 20 | destroyRef?.(); 21 | } 22 | -------------------------------------------------------------------------------- /src/action-sheet/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .action-sheet-demo { 6 | margin-bottom: 16px; 7 | 8 | &-btns { 9 | .t-button { 10 | margin-top: 16px; 11 | 12 | &:first-child { 13 | margin-top: 0; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/action-sheet/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdActionSheetProps } from './type'; 6 | 7 | export const actionSheetDefaultProps: TdActionSheetProps = { 8 | align: 'center', 9 | count: 8, 10 | popupProps: {}, 11 | showCancel: true, 12 | showOverlay: true, 13 | theme: 'list', 14 | defaultVisible: false, 15 | }; 16 | -------------------------------------------------------------------------------- /src/action-sheet/index.tsx: -------------------------------------------------------------------------------- 1 | import './style'; 2 | 3 | import _ActionSheet from './ActionSheet'; 4 | import { show, close } from './ActionSheetMethod'; 5 | import { attachMethodsToComponent } from '../_util/attachMethodsToComponent'; 6 | import type { ActionSheetProps } from './ActionSheet'; 7 | 8 | type ActionSheetWithMethods = React.FC & { 9 | show: typeof show; 10 | close: typeof close; 11 | }; 12 | 13 | export * from './type'; 14 | 15 | export const ActionSheet: ActionSheetWithMethods = attachMethodsToComponent(_ActionSheet, { 16 | show, 17 | close, 18 | }); 19 | 20 | export default ActionSheet; 21 | -------------------------------------------------------------------------------- /src/action-sheet/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/action-sheet/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/action-sheet/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/avatar/AvatarGroupContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from 'react'; 2 | import type { AvatarGroupProps } from './AvatarGroup'; 3 | 4 | export const AvatarGroupContext = React.createContext(null); 5 | 6 | export function AvatarGroupContextProvider(props: Pick) { 7 | const memoInfo = useMemo( 8 | () => ({ 9 | size: props.size, 10 | shape: props.shape, 11 | }), 12 | [props.size, props.shape], 13 | ); 14 | return {props.children}; 15 | } 16 | -------------------------------------------------------------------------------- /src/avatar/_example/characterAvatar.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Avatar } from 'tdesign-mobile-react'; 3 | 4 | export default function CharacterAvatar() { 5 | return ( 6 |

7 | 8 | A 9 | 10 | 11 | A 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/avatar/_example/iconAvatar.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Avatar } from 'tdesign-mobile-react'; 3 | import { UserIcon } from 'tdesign-icons-react'; 4 | 5 | export default function IconAvatar() { 6 | return ( 7 |
8 | } /> 9 | } /> 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/avatar/_example/imageAvatar.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Avatar } from 'tdesign-mobile-react'; 3 | 4 | export default function ImageAvatar() { 5 | return ( 6 |
7 | 8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/avatar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdAvatarProps, TdAvatarGroupProps } from './type'; 6 | 7 | export const avatarDefaultProps: TdAvatarProps = { hideOnLoadFailed: false }; 8 | 9 | export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up' }; 10 | -------------------------------------------------------------------------------- /src/avatar/index.ts: -------------------------------------------------------------------------------- 1 | import _Avatar from './Avatar'; 2 | 3 | import './style/index.js'; 4 | 5 | import _AvatarGroup from './AvatarGroup'; 6 | 7 | export type { AvatarProps } from './Avatar'; 8 | export type { AvatarGroupProps } from './AvatarGroup'; 9 | 10 | export * from './type'; 11 | export * from './AvatarGroupContext'; 12 | 13 | export const Avatar = _Avatar; 14 | export const AvatarGroup = _AvatarGroup; 15 | export default Avatar; 16 | -------------------------------------------------------------------------------- /src/avatar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/avatar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/avatar/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/back-top/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-react-demo { 2 | background: #fff; 3 | overflow: auto; 4 | height: 100vh; 5 | 6 | .button { 7 | margin-bottom: 16px; 8 | } 9 | 10 | .group { 11 | display: flex; 12 | justify-content: space-between; 13 | flex-wrap: wrap; 14 | padding: 0 16px 30px 16px; 15 | .item { 16 | width: 47%; 17 | margin-bottom: 16px; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/back-top/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdBackTopProps } from './type'; 6 | 7 | export const backTopDefaultProps: TdBackTopProps = { 8 | fixed: true, 9 | icon: true, 10 | text: '', 11 | theme: 'round', 12 | visibilityHeight: 200, 13 | }; 14 | -------------------------------------------------------------------------------- /src/back-top/index.ts: -------------------------------------------------------------------------------- 1 | import _BackTop from './Backtop'; 2 | 3 | import './style'; 4 | 5 | export * from './type'; 6 | 7 | export const BackTop = _BackTop; 8 | 9 | export default { BackTop }; 10 | -------------------------------------------------------------------------------- /src/back-top/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/back-top/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/back-top/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/badge/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Avatar } from 'tdesign-mobile-react'; 3 | import { UserIcon } from 'tdesign-icons-react'; 4 | 5 | export default function SizeBadge() { 6 | return ( 7 | <> 8 |
Large
9 |
10 | } size="large" badgeProps={{ count: 8, size: 'large', offset: [7, 7] }} /> 11 |
12 | 13 |
Middle
14 |
15 | } badgeProps={{ count: 8, offset: [5, 5] }} /> 16 |
17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/badge/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .badge-demo { 2 | display: flex; 3 | margin-top: 28px; 4 | margin-bottom: 24px; 5 | margin-left: 16px; 6 | align-items: center; 7 | color: var(--td-text-color-primary, rgba(0, 0, 0, 0.9)); 8 | 9 | .badge-item { 10 | margin-right: 48px; 11 | } 12 | } 13 | 14 | .block { 15 | padding: 16px 16px 24px; 16 | } 17 | -------------------------------------------------------------------------------- /src/badge/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdBadgeProps } from './type'; 6 | 7 | export const badgeDefaultProps: TdBadgeProps = { 8 | count: 0, 9 | dot: false, 10 | maxCount: 99, 11 | shape: 'circle', 12 | showZero: false, 13 | size: 'medium', 14 | }; 15 | -------------------------------------------------------------------------------- /src/badge/index.ts: -------------------------------------------------------------------------------- 1 | import _Badge from './Badge'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { BadgeProps } from './Badge'; 6 | 7 | export * from './type'; 8 | 9 | export const Badge = _Badge; 10 | export default Badge; 11 | -------------------------------------------------------------------------------- /src/badge/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/badge/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/badge/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/button/__tests__/__snapshots__/button.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Button 组件测试 > content 1`] = ` 4 | 7 | 8 | 按钮组件 9 | 10 | `; 11 | -------------------------------------------------------------------------------- /src/button/__tests__/button.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { describe, it, expect, render } from '@test/utils'; 3 | 4 | import Button from '../Button'; 5 | 6 | describe('Button 组件测试', () => { 7 | const ButtonText = '按钮组件'; 8 | it('content', async () => { 9 | const { queryByText } = render( 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/button/_example/ghost.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 |
7 | 10 | 13 | 16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/button/_example/group.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 |
7 | 10 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/button/_example/icon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'tdesign-mobile-react'; 3 | import { Icon } from 'tdesign-icons-react'; 4 | 5 | export default function () { 6 | return ( 7 |
8 | 11 | 14 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/button/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 |
7 | 10 | 11 | 14 | 17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/button/_example/test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | <> 7 | {/* 正确 */} 8 |
9 | 10 | 11 |
12 | 13 | {/* 错误 */} 14 |
15 | 16 | 17 |
18 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /src/button/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdButtonProps } from './type'; 6 | 7 | export const buttonDefaultProps: TdButtonProps = { 8 | block: false, 9 | disabled: undefined, 10 | ghost: false, 11 | loading: false, 12 | shape: 'rectangle', 13 | size: 'medium', 14 | theme: 'default', 15 | type: 'button', 16 | variant: 'base', 17 | }; 18 | -------------------------------------------------------------------------------- /src/button/index.ts: -------------------------------------------------------------------------------- 1 | import _Button from './Button'; 2 | 3 | import './style'; 4 | 5 | export type { ButtonProps } from './Button'; 6 | export * from './type'; 7 | 8 | export const Button = _Button; 9 | export default Button; 10 | -------------------------------------------------------------------------------- /src/button/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/button/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/button/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/calendar/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .is-holiday:not(.t-calendar__dates-item--selected) { 2 | color: #e34d59; 3 | } -------------------------------------------------------------------------------- /src/calendar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCalendarProps } from './type'; 6 | 7 | export const calendarDefaultProps: TdCalendarProps = { 8 | autoClose: true, 9 | confirmBtn: '', 10 | firstDayOfWeek: 0, 11 | title: '请选择日期', 12 | type: 'single', 13 | usePopup: true, 14 | visible: false, 15 | }; 16 | -------------------------------------------------------------------------------- /src/calendar/index.ts: -------------------------------------------------------------------------------- 1 | import _Calendar from './Calendar'; 2 | 3 | import './style'; 4 | 5 | export type { CalendarProps } from './Calendar'; 6 | export * from './type'; 7 | 8 | export const Calendar = _Calendar; 9 | export default Calendar; 10 | -------------------------------------------------------------------------------- /src/calendar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/calendar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/calendar/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/cascader/_example/style/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/src/cascader/_example/style/index.less -------------------------------------------------------------------------------- /src/cascader/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCascaderProps } from './type'; 6 | 7 | export const cascaderDefaultProps: TdCascaderProps = { 8 | closeBtn: true, 9 | lazy: false, 10 | loadCompleted: false, 11 | options: [], 12 | placeholder: '选择选项', 13 | subTitles: [], 14 | theme: 'step', 15 | visible: false, 16 | }; 17 | -------------------------------------------------------------------------------- /src/cascader/index.tsx: -------------------------------------------------------------------------------- 1 | import _Cascader from './Cascader'; 2 | 3 | import './style'; 4 | 5 | export const Cascader = _Cascader; 6 | export type { CascaderProps } from './Cascader'; 7 | 8 | export default Cascader; 9 | -------------------------------------------------------------------------------- /src/cascader/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/cascader/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/cascader/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/cell/_example/group.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { CellGroup, Cell } from 'tdesign-mobile-react'; 3 | import { AppIcon, ServiceIcon, InternetIcon } from 'tdesign-icons-react'; 4 | 5 | export default function Group() { 6 | return ( 7 | 8 | } title="单行标题" arrow /> 9 | } title="单行标题" arrow /> 10 | } title="单行标题" arrow /> 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/cell/_example/style/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/tdesign-mobile-react/6042a4039c50a379b20717a6614bde10813587a9/src/cell/_example/style/index.less -------------------------------------------------------------------------------- /src/cell/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCellProps, TdCellGroupProps } from './type'; 6 | 7 | export const cellDefaultProps: TdCellProps = { align: 'middle', arrow: false, bordered: true, required: false }; 8 | 9 | export const cellGroupDefaultProps: TdCellGroupProps = { bordered: false, theme: 'default' }; 10 | -------------------------------------------------------------------------------- /src/cell/index.tsx: -------------------------------------------------------------------------------- 1 | import _Cell from './Cell'; 2 | 3 | import _CellGroup from './CellGroup'; 4 | 5 | import './style'; 6 | 7 | export * from './type'; 8 | 9 | export const Cell = _Cell; 10 | 11 | export const CellGroup = _CellGroup; 12 | 13 | export default { Cell, CellGroup }; 14 | -------------------------------------------------------------------------------- /src/cell/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/cell/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/cell/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/checkbox/_example/card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Checkbox } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/checkbox/_example/right.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Checkbox } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/checkbox/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Checkbox } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/checkbox/_example/type.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Checkbox } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | const activeImage = 'https://tdesign.gtimg.com/mobile/demos/checkbox-checked.png'; 6 | const inActiveImage = 'https://tdesign.gtimg.com/mobile/demos/checkbox.png'; 7 | 8 | return ( 9 | <> 10 | 11 |
12 | 13 |
14 | 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/checkbox/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCheckboxProps, TdCheckboxGroupProps } from './type'; 6 | 7 | export const checkboxDefaultProps: TdCheckboxProps = { 8 | block: true, 9 | borderless: undefined, 10 | checkAll: false, 11 | defaultChecked: false, 12 | disabled: undefined, 13 | icon: 'circle', 14 | indeterminate: false, 15 | maxContentRow: 5, 16 | maxLabelRow: 3, 17 | placement: 'left', 18 | readonly: undefined, 19 | }; 20 | 21 | export const checkboxGroupDefaultProps: TdCheckboxGroupProps = { 22 | borderless: false, 23 | disabled: undefined, 24 | max: undefined, 25 | readonly: undefined, 26 | defaultValue: [], 27 | }; 28 | -------------------------------------------------------------------------------- /src/checkbox/index.ts: -------------------------------------------------------------------------------- 1 | import _Checkbox from './Checkbox'; 2 | import _CheckboxGroup from './CheckboxGroup'; 3 | 4 | import './style'; 5 | 6 | export type { CheckBoxProps } from './Checkbox'; 7 | export type { CheckboxGroupProps } from './CheckboxGroup'; 8 | 9 | export * from './type'; 10 | 11 | export const Checkbox = _Checkbox; 12 | export const CheckboxGroup = _CheckboxGroup; 13 | 14 | export default Checkbox; 15 | -------------------------------------------------------------------------------- /src/checkbox/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/checkbox/style/index.js: -------------------------------------------------------------------------------- 1 | // index.js 2 | import '../../_common/style/mobile/components/checkbox/v2/_index.less'; 3 | // import '../../_common/style/mobile/components/checkbox-group/_index.less'; 4 | 5 | // css.js 6 | import './index.less'; 7 | -------------------------------------------------------------------------------- /src/checkbox/style/index.less: -------------------------------------------------------------------------------- 1 | .t-checkbox { 2 | .t-checkbox__icon-wrapper { 3 | display: block; 4 | } 5 | } -------------------------------------------------------------------------------- /src/collapse/CollapseContext.tsx: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react'; 2 | import type { CollapseValue } from './type'; 3 | 4 | export interface CollapseContextValue { 5 | activeValue: CollapseValue | undefined; 6 | disabled: boolean; 7 | expandIcon: React.ReactNode; 8 | onPanelChange: (name: string | number, args: { e: React.MouseEvent }) => void; 9 | defaultExpandAll: boolean; 10 | } 11 | 12 | export const CollapseContext = createContext(null); 13 | 14 | export const CollapseProvider = CollapseContext.Provider; 15 | -------------------------------------------------------------------------------- /src/collapse/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Collapse, CollapsePanel } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | 7 | 8 |
9 | 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容可自定义内容 10 |
11 |
12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /src/collapse/_example/placement.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Collapse, CollapsePanel } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | 7 | 8 |
9 | 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容可自定义内容 10 |
11 |
12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /src/collapse/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCollapseProps, TdCollapsePanelProps } from './type'; 6 | 7 | export const collapseDefaultProps: TdCollapseProps = { 8 | defaultExpandAll: false, 9 | expandIcon: true, 10 | expandMutex: false, 11 | theme: 'default', 12 | defaultValue: [], 13 | }; 14 | 15 | export const collapsePanelDefaultProps: TdCollapsePanelProps = { 16 | destroyOnCollapse: false, 17 | disabled: undefined, 18 | expandIcon: undefined, 19 | placement: 'bottom', 20 | }; 21 | -------------------------------------------------------------------------------- /src/collapse/index.ts: -------------------------------------------------------------------------------- 1 | import _Collapse from './Collapse'; 2 | import _CollapsePanel from './CollapsePanel'; 3 | 4 | import './style/index.js'; 5 | 6 | export type { CollapseProps } from './Collapse'; 7 | export type { CollapsePanelProps } from './CollapsePanel'; 8 | 9 | export * from './type'; 10 | 11 | export const Collapse = _Collapse; 12 | export const CollapsePanel = _CollapsePanel; 13 | -------------------------------------------------------------------------------- /src/collapse/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/collapse/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/collapse/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/color-picker/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { ColorPicker } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /src/color-picker/_example/multiple.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { ColorObject, ColorPicker } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | const onChange = (value: string) => { 6 | console.log('change', value); 7 | }; 8 | const onPaletteBarChange = (value: { color: ColorObject }) => { 9 | console.log('onPaletteBarChange', value); 10 | }; 11 | return ; 12 | } 13 | -------------------------------------------------------------------------------- /src/color-picker/constants.ts: -------------------------------------------------------------------------------- 1 | export const HUE_MAX = 360; 2 | export const ALPHA_MAX = 100; 3 | -------------------------------------------------------------------------------- /src/color-picker/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdColorPickerProps } from './type'; 6 | 7 | export const colorPickerDefaultProps: TdColorPickerProps = { 8 | clearable: false, 9 | enableAlpha: false, 10 | fixed: false, 11 | format: 'RGB', 12 | type: 'base', 13 | }; 14 | -------------------------------------------------------------------------------- /src/color-picker/index.ts: -------------------------------------------------------------------------------- 1 | import _ColorPicker from './ColorPicker'; 2 | import './style'; 3 | 4 | export type { ColorPickerProps } from './ColorPicker'; 5 | export * from './type'; 6 | 7 | export const ColorPicker = _ColorPicker; 8 | export default ColorPicker; 9 | -------------------------------------------------------------------------------- /src/color-picker/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/color-picker/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/color-picker/_index.less'; 2 | -------------------------------------------------------------------------------- /src/color-picker/types.ts: -------------------------------------------------------------------------------- 1 | export interface PanelRectType { 2 | width?: number; 3 | height?: number; 4 | top?: number; 5 | left?: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/config-provider/index.ts: -------------------------------------------------------------------------------- 1 | import ConfigProvider, { merge } from './ConfigProvider'; 2 | import ConfigContext from './ConfigContext'; 3 | 4 | export type { Config, Locale } from './ConfigContext'; 5 | export type { ConfigProviderProps } from './ConfigProvider'; 6 | export * from './type'; 7 | 8 | export { ConfigContext, ConfigProvider, merge }; 9 | export default ConfigProvider; 10 | -------------------------------------------------------------------------------- /src/count-down/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .demo-count-down-desc { 6 | color: var(--td-text-color-secondary, rgba(0, 0, 0, 0.6)); 7 | font-size: 14px; 8 | } 9 | 10 | .demo-count-down-content { 11 | margin: 16px 0 24px; 12 | } 13 | 14 | // 覆盖组件内部样式 15 | .custom .t-count-down__item { 16 | color: #e34d59; 17 | font-size: 18px; 18 | line-height: 24px; 19 | vertical-align: middle; 20 | } 21 | 22 | .custom .t-count-down__split { 23 | font-size: 10px; 24 | margin: 0 5px; 25 | } 26 | -------------------------------------------------------------------------------- /src/count-down/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdCountDownProps } from './type'; 6 | 7 | export const countDownDefaultProps: TdCountDownProps = { 8 | autoStart: true, 9 | content: 'default', 10 | format: 'HH:mm:ss', 11 | millisecond: false, 12 | size: 'medium', 13 | splitWithUnit: false, 14 | theme: 'default', 15 | time: 0, 16 | }; 17 | -------------------------------------------------------------------------------- /src/count-down/hooks/useCountDown/index.ts: -------------------------------------------------------------------------------- 1 | import { useCountDown } from './useCountDown'; 2 | 3 | export default useCountDown; 4 | -------------------------------------------------------------------------------- /src/count-down/index.ts: -------------------------------------------------------------------------------- 1 | import _CountDown from './CountDown'; 2 | 3 | export type { CountDownProps, CountDownRef } from './CountDown'; 4 | export * from './type'; 5 | 6 | export const CountDown = _CountDown; 7 | export default CountDown; 8 | -------------------------------------------------------------------------------- /src/count-down/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/count-down/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/count-down/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/dialog/_example/plugin.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Dialog, Button } from 'tdesign-mobile-react'; 3 | 4 | const PluginUsage = React.memo(() => ( 5 |
6 | 23 |
24 | )); 25 | 26 | export default PluginUsage; 27 | -------------------------------------------------------------------------------- /src/dialog/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | 4 | .btn-gap { 5 | width: 100%; 6 | height: 16px; 7 | } 8 | .middle-container { 9 | padding: 20px; 10 | overflow: auto; 11 | max-height: 100px; 12 | } 13 | } 14 | .t-input { 15 | margin-top: 16px; 16 | --td-input-vertical-padding: 12px; 17 | --td-bg-color-container: var(--td-bg-color-page, #f3f3f3); 18 | border-radius: 6px; 19 | } 20 | -------------------------------------------------------------------------------- /src/dialog/alert.ts: -------------------------------------------------------------------------------- 1 | import { MouseEvent } from 'react'; 2 | import { TNode } from '../common'; 3 | import { show } from './show'; 4 | import { DialogProps } from './index'; 5 | 6 | export type DialogAlertProps = Omit & { 7 | confirmBtn?: TNode; 8 | onConfirm?: (context: { e: MouseEvent }) => void; 9 | }; 10 | 11 | export function alert(props: DialogAlertProps) { 12 | const defaultProps: DialogProps = { 13 | confirmBtn: '确认', 14 | }; 15 | 16 | return show({ 17 | ...defaultProps, 18 | ...props, 19 | cancelBtn: null, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /src/dialog/confirm.ts: -------------------------------------------------------------------------------- 1 | import { MouseEvent } from 'react'; 2 | import { TNode } from '../common'; 3 | import { show } from './show'; 4 | import { DialogProps } from './index'; 5 | 6 | export type DialogConfirmProps = Omit & { 7 | confirmBtn?: TNode; 8 | cancelBtn?: TNode; 9 | onCancel?: (context: { e: MouseEvent }) => void; 10 | onConfirm?: (context: { e: MouseEvent }) => void; 11 | }; 12 | 13 | export function confirm(props: DialogConfirmProps) { 14 | const defaultProps: DialogProps = { 15 | confirmBtn: '确认', 16 | cancelBtn: '取消', 17 | }; 18 | 19 | return show({ 20 | ...defaultProps, 21 | ...props, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /src/dialog/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdDialogProps } from './type'; 6 | 7 | export const dialogDefaultProps: TdDialogProps = { 8 | buttonLayout: 'horizontal', 9 | closeBtn: false, 10 | closeOnOverlayClick: false, 11 | destroyOnClose: false, 12 | overlayProps: {}, 13 | preventScrollThrough: true, 14 | showOverlay: true, 15 | }; 16 | -------------------------------------------------------------------------------- /src/dialog/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/dialog/style/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-relative-packages */ 2 | import '../../_common/style/mobile/components/dialog/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/divider/_example/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TDemoBlock from '../../../site/mobile/components/DemoBlock'; 3 | import TDemoHeader from '../../../site/mobile/components/DemoHeader'; 4 | import BaseDemo from './base'; 5 | import ThemeDemo from './theme'; 6 | 7 | import './style/index.less'; 8 | 9 | export default function DividerDemo() { 10 | return ( 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/divider/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .divider-demo__title { 6 | font-size: 14px; 7 | color: var(--td-text-color-secondary, rgba(0, 0, 0, 0.6)); 8 | padding: 8px 16px; 9 | line-height: 20px; 10 | } 11 | .divider-wrapper { 12 | display: flex; 13 | align-items: center; 14 | font-size: 14px; 15 | color: var(--td-text-color-primary, rgba(0, 0, 0, 0.9)); 16 | padding-left: 16px; 17 | } 18 | -------------------------------------------------------------------------------- /src/divider/_example/theme.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Divider } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Theme() { 6 | return ( 7 |
8 |
虚线样式
9 | 10 | 11 | 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/divider/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdDividerProps } from './type'; 6 | 7 | export const dividerDefaultProps: TdDividerProps = { align: 'center', dashed: false, layout: 'horizontal' }; 8 | -------------------------------------------------------------------------------- /src/divider/divider.md: -------------------------------------------------------------------------------- 1 | :: BASE_DOC :: 2 | ## API 3 | 4 | ### Divider Props 5 | 6 | 名称 | 类型 | 默认值 | 描述 | 必传 7 | -- | -- | -- | -- | -- 8 | className | String | - | 类名 | N 9 | style | Object | - | 样式,TS 类型:`React.CSSProperties` | N 10 | align | String | center | 文本位置(仅在水平分割线有效)。可选项:left/right/center | N 11 | children | TNode | - | 子元素,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N 12 | content | TNode | - | 子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N 13 | dashed | Boolean | false | 是否虚线(仅在水平分割线有效) | N 14 | layout | String | horizontal | 分隔线类型有两种:水平和垂直。可选项:horizontal/vertical | N 15 | -------------------------------------------------------------------------------- /src/divider/index.ts: -------------------------------------------------------------------------------- 1 | import _Divider from './Divider'; 2 | import './style'; 3 | 4 | export type { DividerProps } from './Divider'; 5 | export * from './type'; 6 | 7 | export const Divider = _Divider; 8 | export default Divider; 9 | -------------------------------------------------------------------------------- /src/divider/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/divider/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/divider/_index.less'; 2 | -------------------------------------------------------------------------------- /src/divider/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | import { TNode } from '../common'; 8 | 9 | export interface TdDividerProps { 10 | /** 11 | * 文本位置(仅在水平分割线有效) 12 | * @default center 13 | */ 14 | align?: 'left' | 'right' | 'center'; 15 | /** 16 | * 子元素,同 content 17 | */ 18 | children?: TNode; 19 | /** 20 | * 子元素 21 | */ 22 | content?: TNode; 23 | /** 24 | * 是否虚线(仅在水平分割线有效) 25 | * @default false 26 | */ 27 | dashed?: boolean; 28 | /** 29 | * 分隔线类型有两种:水平和垂直 30 | * @default horizontal 31 | */ 32 | layout?: 'horizontal' | 'vertical'; 33 | } 34 | -------------------------------------------------------------------------------- /src/drawer/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .button-host { 6 | margin: 0 16px; 7 | margin-top: auto; 8 | } 9 | -------------------------------------------------------------------------------- /src/drawer/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdDrawerProps } from './type'; 6 | 7 | export const drawerDefaultProps: TdDrawerProps = { 8 | closeOnOverlayClick: true, 9 | destroyOnClose: false, 10 | placement: 'right', 11 | showOverlay: true, 12 | visible: false, 13 | }; 14 | -------------------------------------------------------------------------------- /src/drawer/index.ts: -------------------------------------------------------------------------------- 1 | import _Drawer from './Drawer'; 2 | import { DrawerPlugin as _DrawerPlugin } from './plugin'; 3 | 4 | import './style'; 5 | 6 | export type { DrawerProps } from './Drawer'; 7 | export * from './type'; 8 | 9 | export const Drawer = _Drawer; 10 | 11 | export const drawer = _DrawerPlugin; 12 | export const DrawerPlugin = _DrawerPlugin; 13 | 14 | export default Drawer; 15 | -------------------------------------------------------------------------------- /src/drawer/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/drawer/style/index.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/no-relative-packages 2 | import '../../_common/style/mobile/components/drawer/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/dropdown-menu/DropdownMenuContext.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash-es/noop'; 2 | import React from 'react'; 3 | import { dropdownMenuDefaultProps } from './defaultProps'; 4 | 5 | const DropdownMenuContext = React.createContext({ 6 | ...dropdownMenuDefaultProps, 7 | activedId: '', 8 | onChangeActivedId: noop, 9 | }); 10 | 11 | export default DropdownMenuContext; 12 | -------------------------------------------------------------------------------- /src/dropdown-menu/_example/disabled.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { DropdownItem, DropdownMenu } from 'tdesign-mobile-react'; 3 | 4 | export default function DisabledDemo() { 5 | return ( 6 | 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/dropdown-menu/_example/style/customized.less: -------------------------------------------------------------------------------- 1 | .demo-dropdown-item { 2 | &_label { 3 | padding: 16px 0 0 16px; 4 | font-size: 14px; 5 | color: var(--td-text-color-primary, rgba(0, 0, 0, 0.9)); 6 | } 7 | &_footer { 8 | display: flex; 9 | width: 100%; 10 | --td-button-border-radius: 0; 11 | 12 | .t-button { 13 | flex: 1; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/dropdown-menu/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdDropdownMenuProps, TdDropdownItemProps } from './type'; 6 | 7 | export const dropdownMenuDefaultProps: TdDropdownMenuProps = { 8 | closeOnClickOverlay: true, 9 | direction: 'down', 10 | duration: 200, 11 | showOverlay: true, 12 | zIndex: 11600, 13 | }; 14 | 15 | export const dropdownItemDefaultProps: TdDropdownItemProps = { 16 | disabled: false, 17 | multiple: false, 18 | options: [], 19 | optionsColumns: 1, 20 | placement: 'left', 21 | defaultValue: undefined, 22 | }; 23 | -------------------------------------------------------------------------------- /src/dropdown-menu/index.ts: -------------------------------------------------------------------------------- 1 | import _DropdownItem from './DropdownItem'; 2 | import _DropdownMenu from './DropdownMenu'; 3 | 4 | import './style'; 5 | 6 | export type { DropdownMenuProps } from './DropdownMenu'; 7 | export type { DropdownItemProps } from './DropdownItem'; 8 | 9 | export * from './type'; 10 | 11 | export const DropdownMenu = _DropdownMenu; 12 | export const DropdownItem = _DropdownItem; 13 | export default DropdownMenu; 14 | -------------------------------------------------------------------------------- /src/dropdown-menu/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/dropdown-menu/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/dropdown-item/v2/_index.less'; 2 | import '../../_common/style/mobile/components/dropdown-menu/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/empty/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Empty } from 'tdesign-mobile-react'; 3 | import { InfoCircleFilledIcon } from 'tdesign-icons-react'; 4 | 5 | export default function Base() { 6 | return } description="描述文字" />; 7 | } 8 | -------------------------------------------------------------------------------- /src/empty/_example/buttonEmpty.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Empty, Button } from 'tdesign-mobile-react'; 3 | import { InfoCircleFilledIcon } from 'tdesign-icons-react'; 4 | 5 | export default function ButtonEmpty() { 6 | return ( 7 | } 9 | description="描述文字" 10 | action={ 11 | 14 | } 15 | /> 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/empty/_example/imageEmpty.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Empty } from 'tdesign-mobile-react'; 3 | 4 | export default function ImageEmpty() { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /src/empty/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | -------------------------------------------------------------------------------- /src/empty/index.ts: -------------------------------------------------------------------------------- 1 | import _Empty from './Empty'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { EmptyProps } from './Empty'; 6 | export * from './type'; 7 | 8 | export const Empty = _Empty; 9 | export default Empty; 10 | -------------------------------------------------------------------------------- /src/empty/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/empty/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/empty/_index.less'; 2 | -------------------------------------------------------------------------------- /src/empty/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | import { TNode, TElement } from '../common'; 8 | 9 | export interface TdEmptyProps { 10 | /** 11 | * 操作按钮 12 | */ 13 | action?: TElement; 14 | /** 15 | * 描述文字 16 | */ 17 | description?: TNode; 18 | /** 19 | * 图标 20 | */ 21 | icon?: TNode; 22 | /** 23 | * 图片地址 24 | */ 25 | image?: TNode; 26 | } 27 | -------------------------------------------------------------------------------- /src/fab/_example/advance.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Icon } from 'tdesign-icons-react'; 3 | import { Fab } from 'tdesign-mobile-react'; 4 | 5 | export default function () { 6 | const onClick = (e) => { 7 | console.log('click Fab', e); 8 | }; 9 | return ( 10 | <> 11 | } 13 | text="按钮文字" 14 | draggable="vertical" 15 | style={{ right: '16px', bottom: '32px' }} 16 | onClick={onClick} 17 | /> 18 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /src/fab/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Icon } from 'tdesign-icons-react'; 3 | import { Fab } from 'tdesign-mobile-react'; 4 | 5 | export default function () { 6 | const onClick = (e) => { 7 | console.log('click Fab', e); 8 | }; 9 | const yBounds = [30, 20]; 10 | 11 | return ( 12 | <> 13 | } 15 | draggable="all" 16 | style={{ right: '16px', bottom: '32px' }} 17 | onClick={onClick} 18 | yBounds={yBounds} 19 | /> 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /src/fab/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | -------------------------------------------------------------------------------- /src/fab/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdFabProps } from './type'; 6 | 7 | export const fabDefaultProps: TdFabProps = { draggable: false }; 8 | -------------------------------------------------------------------------------- /src/fab/index.ts: -------------------------------------------------------------------------------- 1 | import _Fab from './Fab'; 2 | 3 | import './style'; 4 | 5 | export * from './type'; 6 | 7 | export const Fab = _Fab; 8 | 9 | export default Fab; 10 | -------------------------------------------------------------------------------- /src/fab/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/fab/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/fab/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/grid/_example/badge.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Grid, GridItem } from 'tdesign-mobile-react'; 3 | 4 | import './style/index.less'; 5 | 6 | const imgUrl = 'https://tdesign.gtimg.com/mobile/demos/example1.png'; 7 | 8 | export default function Badge() { 9 | return ( 10 | <> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/grid/_example/scroll.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Grid, GridItem } from 'tdesign-mobile-react'; 3 | 4 | import './style/index.less'; 5 | 6 | const imgUrl = 'https://tdesign.gtimg.com/mobile/demos/example1.png'; 7 | 8 | export default function Scroll() { 9 | return ( 10 | <> 11 | 12 | {Array.from({ length: 10 }, (_, index) => ( 13 | 14 | ))} 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/grid/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .grid-demo { 2 | margin-bottom: 16px; 3 | } 4 | 5 | .icon-wrapper { 6 | background: #eee; 7 | border-radius: 6px; 8 | width: 40px; 9 | height: 40px; 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | } 14 | -------------------------------------------------------------------------------- /src/grid/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdGridProps, TdGridItemProps } from './type'; 6 | 7 | export const gridDefaultProps: TdGridProps = { align: 'center', border: false, column: 4, theme: 'default' }; 8 | 9 | export const gridItemDefaultProps: TdGridItemProps = { badge: null, layout: 'vertical' }; 10 | -------------------------------------------------------------------------------- /src/grid/index.tsx: -------------------------------------------------------------------------------- 1 | import _Grid from './Grid'; 2 | import _GridItem from './GridItem'; 3 | 4 | import './style'; 5 | 6 | export * from './type'; 7 | 8 | export const Grid = _Grid; 9 | 10 | export const GridItem = _GridItem; 11 | 12 | export default { 13 | Grid, 14 | GridItem 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /src/grid/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/grid/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/grid/v2/_index.less'; 2 | import '../../_common/style/mobile/components/grid-item/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/guide/_example/dialog-body.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './style/dialog-body.less'; 3 | 4 | export default function DialogBody() { 5 | return ( 6 |
7 |

用户引导的说明文案

8 |
9 | demo 10 |
11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/guide/_example/style/dialog-body.less: -------------------------------------------------------------------------------- 1 | .dialog-body { 2 | .img-wrapper { 3 | border-radius: var(--td-radius-default); 4 | overflow: hidden; 5 | img { 6 | vertical-align: bottom; 7 | width: 100%; 8 | } 9 | } 10 | 11 | p { 12 | margin-bottom: 24px; 13 | } 14 | } -------------------------------------------------------------------------------- /src/guide/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .guide-demo { 2 | display: flex; 3 | justify-content: center; 4 | } 5 | .guide-container { 6 | height: 100%; 7 | width: 100%; 8 | position: relative; 9 | } 10 | .main-title { 11 | margin: 16px; 12 | display: inline-block; 13 | } 14 | .title-major { 15 | font-size: 24px; 16 | font-weight: 600; 17 | line-height: 36px; 18 | } 19 | .title-sub { 20 | font-size: 16px; 21 | font-weight: 400; 22 | line-height: 24px; 23 | margin-top: 4px; 24 | color: rgba(0, 0, 0, 0.6); 25 | } 26 | .action { 27 | margin: 16px; 28 | display: grid; 29 | grid-template-columns: repeat(2, 1fr); 30 | gap: 16px; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/guide/_example/style/my-popover.less: -------------------------------------------------------------------------------- 1 | .my-popover { 2 | width: 240px; 3 | } 4 | 5 | .pop-icon { 6 | color: white; 7 | font-size: 32px; 8 | font-weight: bold; 9 | } 10 | 11 | .popover-desc { 12 | margin-top: 16px; 13 | color: #ffffff; 14 | font-size: 16px; 15 | font-weight: 600; 16 | text-align: left; 17 | line-height: 24px; 18 | } 19 | 20 | .popover-action { 21 | margin-top: 16px; 22 | text-align: right; 23 | } 24 | 25 | .popover-action button { 26 | margin-left: 12px; 27 | } -------------------------------------------------------------------------------- /src/guide/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdGuideProps } from './type'; 6 | 7 | export const guideDefaultProps: TdGuideProps = { 8 | hideCounter: false, 9 | hideSkip: false, 10 | highlightPadding: 8, 11 | mode: 'popover', 12 | showOverlay: true, 13 | zIndex: 999999, 14 | }; 15 | -------------------------------------------------------------------------------- /src/guide/index.ts: -------------------------------------------------------------------------------- 1 | import _Guide from './Guide'; 2 | import './style'; 3 | 4 | export type { GuideProps } from './Guide'; 5 | export * from './type'; 6 | 7 | export const Guide = _Guide; 8 | 9 | export default Guide; 10 | -------------------------------------------------------------------------------- /src/guide/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/guide/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/guide/_index.less'; 2 | -------------------------------------------------------------------------------- /src/guide/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | getElmCssPropValue, 3 | isFixed, 4 | getRelativePosition, 5 | getTargetElm, 6 | scrollToParentVisibleArea, 7 | scrollToElm, 8 | } from './dom'; 9 | 10 | export { getElmCssPropValue, isFixed, getRelativePosition, getTargetElm, scrollToParentVisibleArea, scrollToElm }; 11 | -------------------------------------------------------------------------------- /src/hooks/useClass.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import useConfig from './useConfig'; 3 | 4 | export function usePrefixClass(componentName?: string) { 5 | const { classPrefix } = useConfig(); 6 | 7 | return useMemo(() => (componentName ? `${classPrefix}-${componentName}` : classPrefix), [classPrefix, componentName]); 8 | } 9 | -------------------------------------------------------------------------------- /src/hooks/useConfig.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | import ConfigContext from '../config-provider/ConfigContext'; 3 | import { GlobalConfigProvider } from '../config-provider/type'; 4 | 5 | // 获取全局 globalConfig 6 | export default (): GlobalConfigProvider => useContext(ConfigContext).globalConfig; 7 | -------------------------------------------------------------------------------- /src/hooks/useDefaultProps.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | 3 | // defaultProps 将于 18.3.0 废弃,故需实现 hook 在组件内部兼容 4 | // https://github.com/facebook/react/pull/16210 5 | export default function useDefaultProps(originalProps: T, defaultProps: Record): T { 6 | return useMemo(() => { 7 | // eslint-disable-next-line 8 | const props = Object.assign({}, originalProps); 9 | Object.keys(defaultProps).forEach((key) => { 10 | // https://github.com/facebook/react/blob/main/packages/react/src/jsx/ReactJSXElement.js#L719-L722 11 | if (props[key] === undefined) { 12 | props[key] = defaultProps[key]; 13 | } 14 | }); 15 | return props; 16 | }, [originalProps, defaultProps]); 17 | } 18 | -------------------------------------------------------------------------------- /src/hooks/useLayoutEffect.ts: -------------------------------------------------------------------------------- 1 | import { useLayoutEffect, useEffect } from 'react'; 2 | import { canUseDocument } from '../_util/dom'; 3 | 4 | const useIsomorphicLayoutEffect = canUseDocument ? useLayoutEffect : useEffect; 5 | 6 | export default useIsomorphicLayoutEffect; 7 | -------------------------------------------------------------------------------- /src/icon/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .t-demo-iconfont { 6 | .t-icon, 7 | .cps-icon { 8 | margin-right: 24px; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/image-viewer/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: #fff; 3 | min-height: 100%; 4 | } 5 | -------------------------------------------------------------------------------- /src/image-viewer/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdImageViewerProps } from './type'; 6 | 7 | export const imageViewerDefaultProps: TdImageViewerProps = { 8 | closeBtn: true, 9 | deleteBtn: false, 10 | images: [], 11 | defaultIndex: 0, 12 | maxZoom: 3, 13 | showIndex: false, 14 | defaultVisible: false, 15 | }; 16 | -------------------------------------------------------------------------------- /src/image-viewer/index.ts: -------------------------------------------------------------------------------- 1 | import _ImageViewer from './image-viewer'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { ImageViewerProps } from './image-viewer'; 6 | export * from './type'; 7 | 8 | export const ImageViewer = _ImageViewer; 9 | export default ImageViewer; 10 | -------------------------------------------------------------------------------- /src/image-viewer/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/image-viewer/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/image-viewer/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/image-viewer/util.ts: -------------------------------------------------------------------------------- 1 | export function getClientSize() { 2 | const width = document.documentElement.clientWidth; 3 | const height = window.innerHeight || document.documentElement.clientHeight; 4 | return { 5 | width, 6 | height, 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /src/image/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdImageProps } from './type'; 6 | 7 | export const imageDefaultProps: TdImageProps = { fit: 'fill', lazy: false, position: 'center', shape: 'square' }; 8 | -------------------------------------------------------------------------------- /src/image/index.ts: -------------------------------------------------------------------------------- 1 | import _Image from './Image'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { ImageProps } from './Image'; 6 | export * from './type'; 7 | 8 | export const Image = _Image; 9 | export default Image; 10 | -------------------------------------------------------------------------------- /src/image/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/image/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/image/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/index-lib.ts: -------------------------------------------------------------------------------- 1 | import './style'; 2 | 3 | const ENV = process.env.NODE_ENV; 4 | if ( 5 | ENV !== 'test' && 6 | ENV !== 'production' && 7 | typeof console !== 'undefined' && 8 | console.warn && // eslint-disable-line no-console 9 | typeof window !== 'undefined' 10 | ) { 11 | // eslint-disable-next-line no-console 12 | console.warn('You are using a whole package of TDesign!'); 13 | } 14 | 15 | export * from './index'; 16 | -------------------------------------------------------------------------------- /src/indexes/IndexesContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { createContext, useMemo } from 'react'; 2 | 3 | export interface IndexesContextValue { 4 | relation: (ele: HTMLElement, index: string | number) => void; 5 | } 6 | export const IndexesContext = createContext(null); 7 | 8 | export function IndexesProrvider({ value, children }) { 9 | const memoValue = useMemo(() => value, [value]); 10 | return {children}; 11 | } 12 | -------------------------------------------------------------------------------- /src/indexes/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .return-indexes { 6 | position: fixed; 7 | top: 16px; 8 | left: 10px; 9 | z-index: 100; 10 | } 11 | 12 | .capsule { 13 | margin: 0 8px; 14 | padding: 0 16px; 15 | height: 30px; 16 | border-radius: 15px; 17 | background-color: #f3f3f3; 18 | display: flex; 19 | align-items: center; 20 | font-size: 14px; 21 | box-sizing: border-box; 22 | } 23 | 24 | .capsule--active { 25 | background: #fff; 26 | border: 1px solid #e7e7e7; 27 | } 28 | 29 | .tdesign-demo-topnav { 30 | z-index: 2; 31 | } 32 | -------------------------------------------------------------------------------- /src/indexes/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdIndexesProps } from './type'; 6 | 7 | export const indexesDefaultProps: TdIndexesProps = { sticky: true, stickyOffset: 0 }; 8 | -------------------------------------------------------------------------------- /src/indexes/index.tsx: -------------------------------------------------------------------------------- 1 | import _Indexes from './Indexes'; 2 | import _IndexesAnchor from './IndexesAnchor'; 3 | 4 | import './style'; 5 | 6 | export type { IndexesProps } from './Indexes'; 7 | export type { IndexesAnchorProps } from './IndexesAnchor'; 8 | 9 | export * from './type'; 10 | 11 | export const Indexes = _Indexes; 12 | export const IndexesAnchor = _IndexesAnchor; 13 | 14 | export default Indexes; 15 | -------------------------------------------------------------------------------- /src/indexes/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/indexes/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/indexes/v2/_index.less'; 2 | import '../../_common/style/mobile/components/indexes-anchor/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/indexes/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | export interface TdIndexesProps { 8 | /** 9 | * 索引字符列表。不传默认 `A-Z` 10 | */ 11 | indexList?: (string | number)[]; 12 | /** 13 | * 索引是否吸顶,默认为true 14 | * @default true 15 | */ 16 | sticky?: Boolean; 17 | /** 18 | * 锚点吸顶时与顶部的距离 19 | * @default 0 20 | */ 21 | stickyOffset?: number; 22 | /** 23 | * 索引发生变更时触发事件 24 | */ 25 | onChange?: (index: string | number) => void; 26 | /** 27 | * 点击侧边栏时触发事件 28 | */ 29 | onSelect?: (index: string | number) => void; 30 | } 31 | 32 | export interface TdIndexesAnchorProps { 33 | /** 34 | * 索引字符 35 | */ 36 | index?: string | number; 37 | } 38 | -------------------------------------------------------------------------------- /src/input/_example/align.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | 4 | export default function Align() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/input/_example/banner.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Banner() { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /src/input/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/input/_example/bordered.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | import { ErrorCircleFilledIcon } from 'tdesign-icons-react'; 4 | import './style/index.less'; 5 | 6 | export default function Bordered() { 7 | return ( 8 |
9 |
标签文字
10 | } 15 | /> 16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/input/_example/custom.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Custom() { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/input/_example/label.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | 4 | export default function Label() { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /src/input/_example/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | import { ErrorCircleFilledIcon } from 'tdesign-icons-react'; 4 | 5 | export default function Layout() { 6 | return } />; 7 | } 8 | -------------------------------------------------------------------------------- /src/input/_example/maxLength.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | 4 | export default function MaxLength() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/input/_example/prefix.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | import { AppIcon } from 'tdesign-icons-react'; 4 | 5 | export default function Prefix() { 6 | return ( 7 | <> 8 | } /> 9 | } /> 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/input/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Input } from 'tdesign-mobile-react'; 3 | 4 | export default function Status() { 5 | const text1 = '已输入文字'; 6 | const text2 = '不可编辑文字'; 7 | return ( 8 | <> 9 | 10 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/input/_example/suffix.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Input } from 'tdesign-mobile-react'; 3 | import { InfoCircleFilledIcon, UserAvatarIcon } from 'tdesign-icons-react'; 4 | 5 | export default function Suffix() { 6 | return ( 7 | <> 8 | } /> 9 | 14 | {' 操作按钮 '} 15 | 16 | } 17 | /> 18 | } /> 19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/input/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdInputProps } from './type'; 6 | 7 | export const inputDefaultProps: TdInputProps = { 8 | align: 'left', 9 | allowInputOverMax: false, 10 | autocomplete: undefined, 11 | autofocus: false, 12 | borderless: false, 13 | clearTrigger: 'always', 14 | clearable: false, 15 | disabled: undefined, 16 | layout: 'horizontal', 17 | placeholder: undefined, 18 | readonly: undefined, 19 | spellcheck: false, 20 | status: 'default', 21 | type: 'text', 22 | }; 23 | -------------------------------------------------------------------------------- /src/input/index.ts: -------------------------------------------------------------------------------- 1 | import _Input from './Input'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { InputProps } from './Input'; 6 | export * from './type'; 7 | 8 | export const Input = _Input; 9 | export default Input; 10 | -------------------------------------------------------------------------------- /src/input/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/input/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/input/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/layout/__tests__/__snapshots__/demo.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Col > Col baseDemo demo works fine 1`] = `null`; 4 | 5 | exports[`Col > Col indexDemo demo works fine 1`] = `null`; 6 | 7 | exports[`Col > Col offsetDemo demo works fine 1`] = `null`; 8 | -------------------------------------------------------------------------------- /src/layout/__tests__/demo.test.tsx: -------------------------------------------------------------------------------- 1 | import { describe, expect, render, it } from '@test/utils'; 2 | 3 | import baseDemo from '../_example/base'; 4 | import indexDemo from '../_example/index'; 5 | import offsetDemo from '../_example/offset'; 6 | 7 | const mapper = { 8 | baseDemo, 9 | indexDemo, 10 | offsetDemo, 11 | }; 12 | 13 | describe('Col', () => { 14 | Object.keys(mapper).forEach((demoName) => { 15 | it(`Col ${demoName} demo works fine`, () => { 16 | const { container } = render(mapper[demoName]); 17 | 18 | expect(container.firstChild).toMatchSnapshot(); 19 | }); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/layout/_example/offset.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Col, Row } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 |
7 | 8 | 9 |
col-8
10 | 11 | 12 |
col-8
13 | 14 | 15 |
col-8
16 | 17 |
18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /src/layout/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .dark { 2 | background-color: #0052d9; 3 | } 4 | 5 | .light { 6 | background-color: #366ef4; 7 | } 8 | 9 | .dark, 10 | .light { 11 | color: #fff; 12 | font-size: 14px; 13 | line-height: 48px; 14 | margin-bottom: 16px; 15 | text-align: center; 16 | } 17 | 18 | .tdesign-mobile-demo { 19 | min-height: 100%; 20 | box-sizing: border-box; 21 | } 22 | -------------------------------------------------------------------------------- /src/layout/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdColProps, TdRowProps } from './type'; 6 | 7 | export const rowDefaultProps: TdRowProps = { 8 | /** 列之间的间距(默认单位px) */ 9 | gutter: 0, 10 | }; 11 | 12 | export const colDefaultProps: TdColProps = { 13 | /** 列的偏移量(默认单位px) */ 14 | offset: 0, 15 | /** 列的宽度(默认单位px) */ 16 | span: 0, 17 | }; 18 | -------------------------------------------------------------------------------- /src/layout/index.ts: -------------------------------------------------------------------------------- 1 | import _Col from './Col'; 2 | import _Row from './Row'; 3 | 4 | import './style'; 5 | 6 | export type { ColProps } from './Col'; 7 | export type { RowProps } from './Row'; 8 | 9 | export * from './type'; 10 | 11 | export const Col = _Col; 12 | export const Row = _Row; 13 | -------------------------------------------------------------------------------- /src/layout/layout.en-US.md: -------------------------------------------------------------------------------- 1 | :: BASE_DOC :: 2 | 3 | ## API 4 | 5 | 6 | ### Row Props 7 | 8 | name | type | default | description | required 9 | -- | -- | -- | -- | -- 10 | gutter | String / Number | - | \- | N 11 | 12 | 13 | ### Col Props 14 | 15 | name | type | default | description | required 16 | -- | -- | -- | -- | -- 17 | offset | String / Number | - | \- | N 18 | span | String / Number | - | \- | N 19 | -------------------------------------------------------------------------------- /src/layout/layout.md: -------------------------------------------------------------------------------- 1 | :: BASE_DOC :: 2 | 3 | ## API 4 | ### Col Props 5 | 6 | 名称 | 类型 | 默认值 | 说明 | 必传 7 | -- | -- | -- | -- | -- 8 | className | String | - | 类名 | N 9 | style | Object | - | 样式,TS 类型:`React.CSSProperties` | N 10 | offset | String / Number | - | 列的偏移量(默认单位px) | N 11 | span | String / Number | - | 列的宽度(默认单位px) | N 12 | 13 | ### Row Props 14 | 15 | 名称 | 类型 | 默认值 | 说明 | 必传 16 | -- | -- | -- | -- | -- 17 | className | String | - | 类名 | N 18 | style | Object | - | 样式,TS 类型:`React.CSSProperties` | N 19 | gutter | String / Number | - | 列之间的间距(默认单位px) | N 20 | -------------------------------------------------------------------------------- /src/layout/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/layout/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/layout/_index.less'; 2 | -------------------------------------------------------------------------------- /src/layout/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | export interface TdColProps { 8 | /** 9 | * 列的偏移量(默认单位px) 10 | */ 11 | offset?: string | number; 12 | /** 13 | * 列的宽度(默认单位px) 14 | */ 15 | span?: string | number; 16 | } 17 | 18 | export interface TdRowProps { 19 | /** 20 | * 列之间的间距(默认单位px) 21 | */ 22 | gutter?: string | number; 23 | } 24 | -------------------------------------------------------------------------------- /src/link/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | return ( 6 |
7 | 跳转链接 8 | 跳转链接 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/link/_example/linkSize.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'tdesign-mobile-react'; 3 | 4 | export default function Size() { 5 | return ( 6 |
7 | 8 | S跳转链接 9 | 10 | 11 | M跳转链接 12 | 13 | 14 | L跳转链接 15 | 16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/link/_example/prefix.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { LinkIcon } from 'tdesign-icons-react'; 3 | import { Link } from 'tdesign-mobile-react'; 4 | 5 | export default function Prefix() { 6 | return ( 7 |
8 | }> 9 | 跳转链接 10 | 11 | }> 12 | 跳转链接 13 | 14 |
15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/link/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .demo-content { 2 | height: 48px; 3 | background-color: var(--td-bg-color-container, #fff); 4 | display: flex; 5 | justify-content: space-around; 6 | margin-bottom: 6.4vw; 7 | align-items: center; 8 | } 9 | -------------------------------------------------------------------------------- /src/link/_example/suffix.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { JumpIcon } from 'tdesign-icons-react'; 3 | import { Link } from 'tdesign-mobile-react'; 4 | 5 | export default function Suffix() { 6 | return ( 7 |
8 | }> 9 | 跳转链接 10 | 11 | }> 12 | 跳转链接 13 | 14 |
15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/link/_example/underline.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'tdesign-mobile-react'; 3 | 4 | export default function Underline() { 5 | return ( 6 |
7 | 8 | 跳转链接 9 | 10 | 11 | 跳转链接 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/link/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdLinkProps } from './type'; 6 | 7 | export const linkDefaultProps: TdLinkProps = { disabled: undefined, size: 'medium', theme: 'default' }; 8 | -------------------------------------------------------------------------------- /src/link/index.ts: -------------------------------------------------------------------------------- 1 | import _Link from './Link'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { LinkProps } from './Link'; 6 | 7 | export const Link = _Link; 8 | export default Link; 9 | -------------------------------------------------------------------------------- /src/link/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/link/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/link/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/list/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .list-demo { 6 | .t-list { 7 | .cell { 8 | width: 100%; 9 | text-align: center; 10 | } 11 | .error { 12 | text-align: center; 13 | color: #969799; 14 | font-size: 14px; 15 | margin-top: 8px; 16 | } 17 | } 18 | .custom-error { 19 | font-size: 14px; 20 | color: #969799; 21 | text-align: center; 22 | padding-top: 16px; 23 | cursor: default; 24 | 25 | span { 26 | color: #0052d9; 27 | cursor: pointer; 28 | } 29 | } 30 | .t-button { 31 | margin: 0 16px 16px 16px; 32 | width: calc(100% - 32px); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/list/index.ts: -------------------------------------------------------------------------------- 1 | import _List from './list'; 2 | 3 | import './style/index.js'; 4 | 5 | export * from './type'; 6 | 7 | export const List = _List; 8 | export default List; 9 | -------------------------------------------------------------------------------- /src/list/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/list/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/list/_index.less'; 2 | -------------------------------------------------------------------------------- /src/list/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | import { TNode } from '../common'; 8 | 9 | export interface TdListProps { 10 | /** 11 | * 自定义加载中。值为空不显示加载中,值为 'loading' 显示加载中状态,值为 'load-more' 显示加载更多状态。值类型为函数,则表示自定义加载状态呈现内容 12 | */ 13 | asyncLoading?: TNode; 14 | /** 15 | * 底部 16 | */ 17 | footer?: TNode; 18 | /** 19 | * 头部 20 | */ 21 | header?: TNode; 22 | /** 23 | * 点击加载更多时触发 24 | */ 25 | onLoadMore?: () => void; 26 | /** 27 | * 列表滚动时触发,bottomDistance 表示底部距离;scrollTop 表示顶部滚动距离 28 | */ 29 | onScroll?: (bottomDistance: number, scrollTop: number) => void; 30 | } 31 | -------------------------------------------------------------------------------- /src/loading/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from 'tdesign-mobile-react'; 3 | 4 | export default function BaseLoading() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/loading/_example/delay.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Loading, Switch } from 'tdesign-mobile-react'; 3 | 4 | export default function DelayLoading() { 5 | const [showLoading, setShowLoading] = useState(false); 6 | 7 | const clickSwitch = (value) => { 8 | setShowLoading(value); 9 | }; 10 | 11 | return ( 12 |
13 | 14 |
15 | 16 |
17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/loading/_example/horz.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from 'tdesign-mobile-react'; 3 | 4 | export default function HorzLoading() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/loading/_example/pure-text.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from 'tdesign-mobile-react'; 3 | 4 | export default function PureTextLoading() { 5 | return ( 6 | <> 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/loading/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from 'tdesign-mobile-react'; 3 | 4 | export default function SizeLoading() { 5 | return ( 6 | <> 7 |
8 |
大尺寸
9 | 10 |
11 |
12 |
中尺寸
13 | 14 |
15 |
16 |
小尺寸
17 | 18 |
19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/loading/_example/speed.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Loading, Slider } from 'tdesign-mobile-react'; 3 | 4 | export default function SpeedLoading() { 5 | const [speed, setSpeed] = useState(5); 6 | 7 | const onChange = (value) => { 8 | setSpeed(value); 9 | }; 10 | 11 | return ( 12 | <> 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /src/loading/_example/vert.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from 'tdesign-mobile-react'; 3 | 4 | export default function VertLoading() { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/loading/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdLoadingProps } from './type'; 6 | 7 | export const loadingDefaultProps: TdLoadingProps = { 8 | attach: '', 9 | delay: 0, 10 | duration: 800, 11 | fullscreen: false, 12 | indicator: true, 13 | inheritColor: false, 14 | layout: 'horizontal', 15 | loading: true, 16 | pause: false, 17 | preventScrollThrough: true, 18 | size: '20px', 19 | theme: 'circular', 20 | }; 21 | -------------------------------------------------------------------------------- /src/loading/index.ts: -------------------------------------------------------------------------------- 1 | import _Loading from './Loading'; 2 | import { LoadingPlugin as _LoadingPlugin } from './plugin'; 3 | 4 | import './style/index.js'; 5 | 6 | export type { LoadingProps } from './Loading'; 7 | export * from './type'; 8 | 9 | export const Loading = _Loading; 10 | export const loading = _LoadingPlugin; 11 | export const LoadingPlugin = _LoadingPlugin; 12 | 13 | export default Loading; 14 | -------------------------------------------------------------------------------- /src/loading/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/loading/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/loading/_index.less'; 2 | -------------------------------------------------------------------------------- /src/locale/ar_KW.ts: -------------------------------------------------------------------------------- 1 | import arKW from '../_common/js/global-config/mobile/locale/ar_KW'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default arKW as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/en_US.ts: -------------------------------------------------------------------------------- 1 | import enUS from '../_common/js/global-config/mobile/locale/en_US'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确,本次提交就检查出了英文字段缺少 5 | export default enUS as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/it_IT.ts: -------------------------------------------------------------------------------- 1 | import itIT from '../_common/js/global-config/mobile/locale/it_IT'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default itIT as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/ja_JP.ts: -------------------------------------------------------------------------------- 1 | import jaJP from '../_common/js/global-config/mobile/locale/ja_JP'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default jaJP as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/ko_KR.ts: -------------------------------------------------------------------------------- 1 | import koKR from '../_common/js/global-config/mobile/locale/ko_KR'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default koKR as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/ru_RU.ts: -------------------------------------------------------------------------------- 1 | import ruRU from '../_common/js/global-config/mobile/locale/ru_RU'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default ruRU as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/zh_CN.ts: -------------------------------------------------------------------------------- 1 | import zhCN from '../_common/js/global-config/mobile/locale/zh_CN'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default zhCN as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/locale/zh_TW.ts: -------------------------------------------------------------------------------- 1 | import zhTW from '../_common/js/global-config/mobile/locale/zh_TW'; 2 | import { GlobalConfigProvider } from '../config-provider/type'; 3 | 4 | // 需要 GlobalConfigProvider 保证数据类型正确 5 | export default zhTW as unknown as GlobalConfigProvider; 6 | -------------------------------------------------------------------------------- /src/message/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .button { 2 | margin-bottom: 16px; 3 | } 4 | -------------------------------------------------------------------------------- /src/message/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdMessageProps } from './type'; 6 | 7 | export const messageDefaultProps: TdMessageProps = { 8 | align: 'left', 9 | duration: 3000, 10 | icon: true, 11 | marquee: false, 12 | theme: 'info', 13 | defaultVisible: false, 14 | }; 15 | -------------------------------------------------------------------------------- /src/message/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/message/style/index.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/no-relative-packages 2 | import '../../_common/style/mobile/components/message/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/navbar/_example/custom-color.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Navbar } from 'tdesign-mobile-react'; 3 | import { EllipsisIcon } from 'tdesign-icons-react'; 4 | 5 | const CustomColorDemo = () => ( 6 | <> 7 | 14 | 15 | 16 | } 17 | /> 18 | 19 | ); 20 | 21 | export default CustomColorDemo; 22 | -------------------------------------------------------------------------------- /src/navbar/_example/img.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Navbar } from 'tdesign-mobile-react'; 3 | import { EllipsisIcon, HomeIcon } from 'tdesign-icons-react'; 4 | 5 | const ImgDemo = () => ( 6 | <> 7 | } 9 | right={ 10 | <> 11 | 12 | 13 | 14 | } 15 | fixed={false} 16 | /> 17 | 18 | ); 19 | 20 | export default ImgDemo; 21 | -------------------------------------------------------------------------------- /src/navbar/_example/search.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Navbar, Search } from 'tdesign-mobile-react'; 3 | import { HomeIcon, EllipsisIcon } from 'tdesign-icons-react'; 4 | 5 | const SearchDemo = () => ( 6 | } 9 | right={ 10 | <> 11 | 12 | 13 | 14 | } 15 | > 16 | ); 17 | 18 | export default SearchDemo; 19 | -------------------------------------------------------------------------------- /src/navbar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdNavbarProps } from './type'; 6 | 7 | export const navbarDefaultProps: TdNavbarProps = { animation: true, fixed: true, leftArrow: false, visible: true }; 8 | -------------------------------------------------------------------------------- /src/navbar/index.ts: -------------------------------------------------------------------------------- 1 | import _Navbar from './Navbar'; 2 | 3 | import './style'; 4 | 5 | export type { NavbarProps } from './Navbar'; 6 | export * from './type'; 7 | 8 | export const Navbar = _Navbar; 9 | export default Navbar; 10 | -------------------------------------------------------------------------------- /src/navbar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/navbar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/navbar/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/notice-bar/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /src/notice-bar/_example/custom.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | import { ChevronRightIcon, SoundIcon } from 'tdesign-icons-react'; 4 | import './style/index.less'; 5 | 6 | export default function Custom() { 7 | return ( 8 | } 13 | suffixIcon={} 14 | /> 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/notice-bar/_example/customization.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link, NoticeBar } from 'tdesign-mobile-react'; 3 | import { CloseIcon } from 'tdesign-icons-react'; 4 | import './style/index.less'; 5 | 6 | export default function Customization() { 7 | return ( 8 | 13 | 详情 14 | 15 | } 16 | suffixIcon={} 17 | /> 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/notice-bar/_example/event.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar, Toast } from 'tdesign-mobile-react'; 3 | import { ChevronRightIcon } from 'tdesign-icons-react'; 4 | import './style/index.less'; 5 | 6 | export default function Event() { 7 | const handleClick = (context: string) => { 8 | Toast({ message: `click:${context}` }); 9 | }; 10 | return ( 11 | } 16 | onClick={handleClick} 17 | /> 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/notice-bar/_example/iconDemo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | 4 | export default function IconDemo() { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /src/notice-bar/_example/scrolling.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | import { SoundIcon } from 'tdesign-icons-react'; 5 | 6 | export default function Scrolling() { 7 | const content = '提示文字描述提示文字描述提示文字描述提示文字描述文'; 8 | const content1 = ['君不见', '高堂明镜悲白发', '朝如青丝暮成雪', '人生得意须尽欢', '莫使金樽空对月']; 9 | 10 | return ( 11 | <> 12 | 13 | 14 | } /> 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/notice-bar/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .cover-class { 6 | background-color: var(--bg-color-demo, #fff); 7 | 8 | .t-icon { 9 | color: var(--td-text-color-primary, rgba(0, 0, 0, 0.9)) !important; 10 | } 11 | 12 | .t-notice-bar__text { 13 | color: var(--bg-color-demo, #fff) !important; 14 | } 15 | } 16 | 17 | .custom-link { 18 | margin-left: 2px; 19 | } 20 | 21 | .notice-bar-demo-block { 22 | margin-bottom: 16px; 23 | } 24 | -------------------------------------------------------------------------------- /src/notice-bar/_example/suffixIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | import { CloseIcon } from 'tdesign-icons-react'; 4 | 5 | export default function SuffixIcon() { 6 | return } />; 7 | } 8 | -------------------------------------------------------------------------------- /src/notice-bar/_example/theme.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NoticeBar } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function ThemeDemo() { 6 | return ( 7 | <> 8 | 9 | 10 | 11 | 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /src/notice-bar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdNoticeBarProps } from './type'; 6 | 7 | export const noticeBarDefaultProps: TdNoticeBarProps = { 8 | direction: 'horizontal', 9 | marquee: false, 10 | theme: 'info', 11 | defaultVisible: false, 12 | }; 13 | -------------------------------------------------------------------------------- /src/notice-bar/index.ts: -------------------------------------------------------------------------------- 1 | import _NoticeBar from './NoticeBar'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { NoticeBarProps } from './NoticeBar'; 6 | 7 | export * from './type'; 8 | 9 | export const NoticeBar = _NoticeBar; 10 | 11 | export default NoticeBar; 12 | 13 | -------------------------------------------------------------------------------- /src/notice-bar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/notice-bar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/notice-bar/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/overlay/_example/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TDemoBlock from '../../../site/mobile/components/DemoBlock'; 3 | import TDemoHeader from '../../../site/mobile/components/DemoHeader'; 4 | import BaseDemo from './base'; 5 | 6 | import './style/index.less'; 7 | 8 | export default function ProgressDemo() { 9 | return ( 10 |
11 | 12 | 13 | 14 | 15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/overlay/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | -------------------------------------------------------------------------------- /src/overlay/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdOverlayProps } from './type'; 6 | 7 | export const overlayDefaultProps: TdOverlayProps = { 8 | duration: 300, 9 | preventScrollThrough: true, 10 | visible: false, 11 | zIndex: 1000, 12 | }; 13 | -------------------------------------------------------------------------------- /src/overlay/index.tsx: -------------------------------------------------------------------------------- 1 | import _Overlay from './Overlay'; 2 | 3 | import './style'; 4 | 5 | export const Overlay = _Overlay; 6 | export type { OverlayProps } from './Overlay'; 7 | 8 | export default Overlay; 9 | -------------------------------------------------------------------------------- /src/overlay/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/overlay/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/overlay/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/picker/_example/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TDemoHeader from '../../../site/mobile/components/DemoHeader'; 3 | import BaseDemo from './base'; 4 | 5 | export default function PickerDemo() { 6 | return ( 7 |
8 | 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/picker/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo-block { 2 | .t-cell__title { 3 | flex: none; 4 | width: 80px; 5 | } 6 | .cell-container { 7 | margin-top: 16px; 8 | } 9 | .t-cell__note { 10 | flex: 1; 11 | .note-panel { 12 | opacity: 0.9; 13 | width: 100%; 14 | padding-left: 16px; 15 | text-align: left; 16 | &.empty { 17 | opacity: 0.26; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/picker/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | export const pickerDefaultProps = { cancelBtn: '取消', confirmBtn: '确认', header: true, visible: false }; 6 | 7 | export const pickerItemDefaultProps = { options: [] }; 8 | -------------------------------------------------------------------------------- /src/picker/index.ts: -------------------------------------------------------------------------------- 1 | import _Picker from './Picker'; 2 | import _PickerView from './PickerView'; 3 | import _PickerItem from './PickerItem'; 4 | import './style'; 5 | 6 | export type { PickerProps } from './Picker'; 7 | export type { PickerViewProps } from './PickerView'; 8 | export type { PickerItemProps } from './PickerItem'; 9 | export * from './type'; 10 | 11 | export const Picker = _Picker; 12 | export const PickerView = _PickerView; 13 | export const PickerItem = _PickerItem; 14 | 15 | export default Picker; 16 | -------------------------------------------------------------------------------- /src/picker/picker-context.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TdPickerProps } from './type'; 3 | 4 | const PickerContext = React.createContext>(null); 5 | 6 | export default PickerContext; 7 | -------------------------------------------------------------------------------- /src/picker/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/picker/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/picker/_index.less'; 2 | -------------------------------------------------------------------------------- /src/popover/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdPopoverProps } from './type'; 6 | 7 | export const popoverDefaultProps: TdPopoverProps = { 8 | closeOnClickOutside: true, 9 | placement: 'top', 10 | showArrow: true, 11 | theme: 'dark', 12 | }; 13 | -------------------------------------------------------------------------------- /src/popover/index.ts: -------------------------------------------------------------------------------- 1 | import _Popover from './Popover'; 2 | import { TdPopoverProps } from './type'; 3 | 4 | import './style'; 5 | 6 | export * from './type'; 7 | export type PopoverProps = TdPopoverProps; 8 | 9 | export const Popover = _Popover; 10 | export default Popover; 11 | -------------------------------------------------------------------------------- /src/popover/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/popover/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/popover/_index.less'; 2 | -------------------------------------------------------------------------------- /src/popup/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdPopupProps } from './type'; 6 | 7 | export const popupDefaultProps: TdPopupProps = { 8 | attach: 'body', 9 | closeOnOverlayClick: true, 10 | destroyOnClose: false, 11 | overlayProps: {}, 12 | placement: 'top', 13 | preventScrollThrough: true, 14 | showOverlay: true, 15 | }; 16 | -------------------------------------------------------------------------------- /src/popup/index.tsx: -------------------------------------------------------------------------------- 1 | import _Popup from './Popup'; 2 | 3 | import './style'; 4 | 5 | export type { PopupProps } from './Popup'; 6 | export const Popup = _Popup; 7 | 8 | export default Popup; 9 | -------------------------------------------------------------------------------- /src/popup/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/popup/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/popup/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/progress/_example/custom.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Progress } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Custom() { 6 | const customPercentage = 88; 7 | return ( 8 |
9 |
10 | 11 | {customPercentage}% 12 | 13 |
14 |
15 | 16 |
17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/progress/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: #fff; 3 | } 4 | 5 | .example-progress { 6 | &__item { 7 | padding: 0 16px; 8 | margin-bottom: 16px; 9 | } 10 | 11 | .summary { 12 | margin-bottom: 16px; 13 | } 14 | 15 | .button-group { 16 | display: flex; 17 | justify-content: center; 18 | padding-bottom: 8px; 19 | .space { 20 | width: 16px; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/progress/constants.ts: -------------------------------------------------------------------------------- 1 | // 进度大于 10 ,进度百分比显示在内部;进度百分比小于 10 进度显示在外部 2 | export const PLUMP_SEPARATE = 10; 3 | -------------------------------------------------------------------------------- /src/progress/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdProgressProps } from './type'; 6 | 7 | export const progressDefaultProps: TdProgressProps = { 8 | color: '', 9 | label: true, 10 | percentage: 0, 11 | size: 'default', 12 | theme: 'line', 13 | trackColor: '', 14 | }; 15 | -------------------------------------------------------------------------------- /src/progress/index.tsx: -------------------------------------------------------------------------------- 1 | import _Progress from './Progress'; 2 | 3 | import './style'; 4 | 5 | export type { ProgressProps } from './Progress'; 6 | export * from './type'; 7 | 8 | export const Progress = _Progress; 9 | export default Progress; 10 | -------------------------------------------------------------------------------- /src/progress/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/progress/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/progress/_index.less'; 2 | -------------------------------------------------------------------------------- /src/pull-down-refresh/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PullDownRefresh } from 'tdesign-mobile-react'; 3 | 4 | export default function BaseDemo({ children }) { 5 | return ( 6 |
7 | 12 | new Promise((resolve) => { 13 | setTimeout(() => { 14 | resolve(1); 15 | }, 2000); 16 | }) 17 | } 18 | > 19 | {children} 20 | 21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/pull-down-refresh/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdPullDownRefreshProps } from './type'; 6 | 7 | export const pullDownRefreshDefaultProps: TdPullDownRefreshProps = { 8 | disabled: false, 9 | loadingBarHeight: 50, 10 | loadingTexts: [], 11 | maxBarHeight: 80, 12 | refreshTimeout: 3000, 13 | defaultValue: false, 14 | }; 15 | -------------------------------------------------------------------------------- /src/pull-down-refresh/index.ts: -------------------------------------------------------------------------------- 1 | import _PullDownRefresh from './PullDownRefresh'; 2 | import './style'; 3 | 4 | export type { PullDownRefreshProps } from './PullDownRefresh'; 5 | export * from './type'; 6 | 7 | export const PullDownRefresh = _PullDownRefresh; 8 | export default PullDownRefresh; 9 | -------------------------------------------------------------------------------- /src/pull-down-refresh/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/pull-down-refresh/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/pull-down-refresh/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/radio/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Radio, RadioGroup } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | const [defaultValue, setDefaultValue] = useState('idx0'); 6 | return ( 7 | setDefaultValue(value)}> 8 | 9 | 10 | 11 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/radio/_example/card.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Radio, RadioGroup } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | const [defaultValue, setDefaultValue] = useState('1'); 6 | const options = [ 7 | { 8 | value: '1', 9 | label: '单选', 10 | }, 11 | { 12 | value: '2', 13 | label: '单选', 14 | }, 15 | { 16 | value: '3', 17 | label: '单选标题多行单选标题多行单选标题多行单选标题多行单选标题多行', 18 | }, 19 | ]; 20 | return ( 21 | 22 | {options.map((opt) => )} 23 | 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/radio/_example/horizontal.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Radio, RadioGroup } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | const [defaultValue, setDefaultValue] = useState('idx0'); 6 | return ( 7 | setDefaultValue(value)}> 8 | 9 | 10 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/radio/_example/icon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Radio } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/radio/_example/placement.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Radio } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | <> 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/radio/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Radio, RadioGroup } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | const defaultValue = '1'; 6 | const options = [ 7 | { 8 | value: '1', 9 | label: '选项禁用-已选', 10 | }, 11 | { 12 | value: '2', 13 | label: '选项禁用-默认', 14 | }, 15 | ]; 16 | return ( 17 | 18 | {options.map((opt) => )} 19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/radio/index.ts: -------------------------------------------------------------------------------- 1 | import _Radio from './Radio'; 2 | import _RadioGroup from './RadioGroup'; 3 | 4 | import './style/index.js'; 5 | 6 | export type { RadioProps } from './Radio'; 7 | export type { RadioGroupProps } from './RadioGroup'; 8 | export * from './type'; 9 | 10 | export const Radio = _Radio; 11 | export const RadioGroup = _RadioGroup; 12 | 13 | export default { 14 | Radio, 15 | RadioGroup, 16 | }; 17 | -------------------------------------------------------------------------------- /src/radio/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/radio/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/radio/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/rate/_example/action.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Cell, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Action(props: { allowHalf: boolean }) { 5 | const { allowHalf } = props; 6 | return ( 7 | 8 | 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/rate/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Cell, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | const [value, setValue] = useState(3); 6 | 7 | return ( 8 | 9 | { 12 | setValue(value); 13 | }} 14 | /> 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/rate/_example/color.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Cell, CellGroup, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Color() { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/rate/_example/count.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Cell, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Count() { 5 | const [value, setValue] = useState(2); 6 | 7 | return ( 8 | 9 | { 13 | setValue(value); 14 | }} 15 | /> 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/rate/_example/custom.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { ThumbUpIcon } from 'tdesign-icons-react'; 3 | import { Cell, Rate } from 'tdesign-mobile-react'; 4 | 5 | export default function Custom() { 6 | const [value, setValue] = useState(3); 7 | 8 | return ( 9 | 10 | , ]} 12 | value={value} 13 | onChange={(value) => { 14 | setValue(value); 15 | }} 16 | /> 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/rate/_example/placement.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Cell, CellGroup, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Placement() { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/rate/_example/show-text.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Cell, CellGroup, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function ShowText() { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/rate/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Cell, CellGroup, Rate } from 'tdesign-mobile-react'; 3 | 4 | export default function Size() { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/rate/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .rate-demo__show-text, 2 | .rate-demo__placement, 3 | .rate-demo__size, 4 | .rate-demo__color { 5 | .t-cell { 6 | margin-bottom: 16px; 7 | } 8 | } 9 | 10 | .desc { 11 | color: var(--td-text-color-primary, rgba(0, 0, 0, 0.9)); 12 | 13 | &--active { 14 | color: #ed7b2f; 15 | font-weight: 600; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/rate/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdRateProps } from './type'; 6 | 7 | export const rateDefaultProps: TdRateProps = { 8 | allowHalf: false, 9 | color: '#ED7B2F', 10 | count: 5, 11 | disabled: undefined, 12 | gap: 8, 13 | placement: 'top', 14 | showText: false, 15 | size: '24px', 16 | texts: [], 17 | defaultValue: 0, 18 | }; 19 | -------------------------------------------------------------------------------- /src/rate/index.ts: -------------------------------------------------------------------------------- 1 | import _Rate from './Rate'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { RateProps } from './Rate'; 6 | export * from './type'; 7 | 8 | export const Rate = _Rate; 9 | export default Rate; 10 | -------------------------------------------------------------------------------- /src/rate/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/rate/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/rate/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/result/_example/custom.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Image, Result } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function CustomResult() { 6 | return ( 7 | } 9 | title="自定义结果" 10 | description="描述文字" 11 | /> 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/result/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | background-color: var(--td-bg-color-container); 3 | } 4 | 5 | .extra-class-image { 6 | width: 108px; 7 | } 8 | 9 | .space { 10 | margin-bottom: 48px; 11 | } 12 | 13 | .tdesign-mobile-demo { 14 | .padding { 15 | padding: 0 16px 16px; 16 | } 17 | } 18 | 19 | .result-page { 20 | height: calc(100vh - 50px); 21 | background-color: var(--bg-color-demo, #fff); 22 | 23 | .demo-section__wrapper { 24 | padding: 24px 16px; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/result/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdResultProps } from './type'; 6 | 7 | export const resultDefaultProps: TdResultProps = { theme: 'default', title: '' }; 8 | -------------------------------------------------------------------------------- /src/result/index.ts: -------------------------------------------------------------------------------- 1 | import _Result from './Result'; 2 | import './style/index.js'; 3 | 4 | export type { ResultProps } from './Result'; 5 | export * from './type'; 6 | 7 | export const Result = _Result; 8 | export default Result; 9 | -------------------------------------------------------------------------------- /src/result/result.md: -------------------------------------------------------------------------------- 1 | :: BASE_DOC :: 2 | 3 | ## API 4 | 5 | 6 | ### Result Props 7 | 8 | 名称 | 类型 | 默认值 | 描述 | 必传 9 | -- | -- | -- | -- | -- 10 | className | String | - | 类名 | N 11 | style | Object | - | 样式,TS 类型:`React.CSSProperties` | N 12 | description | TNode | - | 描述文字。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N 13 | image | TNode | - | 图片地址。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N 14 | theme | String | default | 内置主题。可选项:default/success/warning/error | N 15 | title | TNode | '' | 标题。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N 16 | -------------------------------------------------------------------------------- /src/result/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/result/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/result/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/result/type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /** 4 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 5 | * */ 6 | 7 | import { TNode } from '../common'; 8 | 9 | export interface TdResultProps { 10 | /** 11 | * 描述文字 12 | */ 13 | description?: TNode; 14 | /** 15 | * 图片地址 16 | */ 17 | image?: TNode; 18 | /** 19 | * 内置主题 20 | * @default default 21 | */ 22 | theme?: 'default' | 'success' | 'warning' | 'error'; 23 | /** 24 | * 标题 25 | * @default '' 26 | */ 27 | title?: TNode; 28 | } 29 | -------------------------------------------------------------------------------- /src/search/_example/action.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Search } from 'tdesign-mobile-react'; 3 | 4 | export default function Action() { 5 | const onChange = (val: string) => { 6 | console.log('change: ', val); 7 | }; 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/search/_example/other.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Search } from 'tdesign-mobile-react'; 3 | 4 | export default function Other() { 5 | const onChange = (val: string) => { 6 | console.log('change: ', val); 7 | }; 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/search/_example/shape.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Search } from 'tdesign-mobile-react'; 3 | 4 | export default function Shape() { 5 | const [value, setValue] = useState(''); 6 | const onChange = (val: string) => { 7 | console.log('change: ', val); 8 | setValue(val); 9 | }; 10 | return ( 11 |
12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/search/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .search-example { 2 | background-color: var(--td-bg-color-container); 3 | padding: 8px 16px; 4 | } 5 | -------------------------------------------------------------------------------- /src/search/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSearchProps } from './type'; 6 | 7 | export const searchDefaultProps: TdSearchProps = { 8 | action: '', 9 | center: false, 10 | clearable: true, 11 | disabled: false, 12 | focus: false, 13 | leftIcon: 'search', 14 | placeholder: '', 15 | readonly: false, 16 | shape: 'square', 17 | }; 18 | -------------------------------------------------------------------------------- /src/search/index.ts: -------------------------------------------------------------------------------- 1 | import _Search from './Search'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { SearchProps } from './Search'; 6 | export * from './type'; 7 | 8 | export const Search = _Search; 9 | export default Search; 10 | -------------------------------------------------------------------------------- /src/search/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/search/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/search/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/side-bar/__tests__/__snapshots__/side-bar.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`SideBar 组件测试 > content 1`] = `null`; 4 | -------------------------------------------------------------------------------- /src/side-bar/__tests__/side-bar.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { describe, it, expect, render } from '@test/utils'; 3 | 4 | import SideBar from '../SideBar'; 5 | 6 | describe('SideBar 组件测试', () => { 7 | const SideBarText = 'SideBar组件'; 8 | it('content', async () => { 9 | const { queryByText } = render(); 10 | expect(queryByText(SideBarText)).toMatchSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/side-bar/_example/style/base.less: -------------------------------------------------------------------------------- 1 | .side-bar-wrapper { 2 | &.section-base { 3 | display: flex; 4 | height: calc(100vh - 50px); 5 | background-color: var(--bg-color-demo, #fff); 6 | z-index: 0; 7 | .content { 8 | flex: 1; 9 | overflow-y: scroll; 10 | } 11 | 12 | .section { 13 | padding: 16px 0; 14 | } 15 | 16 | .title { 17 | padding-left: 20px; 18 | margin-bottom: 4px; 19 | line-height: 26px; 20 | } 21 | 22 | .image { 23 | width: 48px; 24 | height: 48px; 25 | } 26 | } 27 | } 28 | 29 | .tdesign-demo-topnav { 30 | z-index: 1; 31 | } 32 | -------------------------------------------------------------------------------- /src/side-bar/_example/style/custom.less: -------------------------------------------------------------------------------- 1 | .side-bar-wrapper { 2 | &.section-custom { 3 | display: flex; 4 | height: calc(100vh - 50px); 5 | background-color: var(--bg-color-demo, #fff); 6 | 7 | --td-side-bar-border-radius: 6px; 8 | --td-side-bar-active-color: green; 9 | 10 | .content { 11 | flex: 1; 12 | overflow-y: scroll; 13 | } 14 | 15 | .section { 16 | padding: 16px 0; 17 | } 18 | 19 | .title { 20 | padding-left: 20px; 21 | margin-bottom: 4px; 22 | line-height: 26px; 23 | } 24 | 25 | .image { 26 | width: 48px; 27 | height: 48px; 28 | } 29 | } 30 | } 31 | 32 | .tdesign-demo-topnav { 33 | z-index: 1; 34 | } 35 | -------------------------------------------------------------------------------- /src/side-bar/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | padding-bottom: 28px; 3 | background-color: var(--td-bg-color-container); 4 | 5 | .t-button { 6 | margin-bottom: 16px; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/side-bar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSideBarProps, TdSideBarItemProps } from './type'; 6 | 7 | export const sideBarDefaultProps: TdSideBarProps = { defaultValue: undefined }; 8 | 9 | export const sideBarItemDefaultProps: TdSideBarItemProps = { disabled: false }; 10 | -------------------------------------------------------------------------------- /src/side-bar/index.ts: -------------------------------------------------------------------------------- 1 | import _SideBar from './SideBar'; 2 | import _SideBarItem from './SideBarItem'; 3 | 4 | import './style'; 5 | 6 | export type { SideBarProps } from './SideBar'; 7 | export type { SideBarItemProps } from './SideBarItem'; 8 | export * from './type'; 9 | 10 | export const SideBar = _SideBar; 11 | export const SideBarItem = _SideBarItem; 12 | 13 | export default { 14 | SideBar, 15 | SideBarItem, 16 | }; 17 | -------------------------------------------------------------------------------- /src/side-bar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/side-bar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/side-bar/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/skeleton/_example/image-group.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Skeleton } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | const rowCols = [{ size: '163.5px', borderRadius: '12px' }, 1, { width: '61%' }]; 6 | 7 | export default function ImageGroupSkeleton() { 8 | return ( 9 | <> 10 |
11 | 12 | 13 |
14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/skeleton/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSkeletonProps } from './type'; 6 | 7 | export const skeletonDefaultProps: TdSkeletonProps = { animation: 'none', delay: 0, loading: true, theme: 'text' }; 8 | -------------------------------------------------------------------------------- /src/skeleton/index.ts: -------------------------------------------------------------------------------- 1 | import _Skeleton from './Skeleton'; 2 | 3 | import './style/index.js'; 4 | 5 | export type { SkeletonProps } from './Skeleton'; 6 | export * from './type'; 7 | 8 | export const Skeleton = _Skeleton; 9 | export default Skeleton; 10 | -------------------------------------------------------------------------------- /src/skeleton/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/skeleton/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/skeleton/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/slider/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Slider } from 'tdesign-mobile-react'; 3 | 4 | export default function BaseDemo() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/slider/_example/range.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Slider } from 'tdesign-mobile-react'; 3 | 4 | export default function RangDemo() { 5 | const onChange = (value: number | number[]) => { 6 | console.log(`change to ${value}`); 7 | }; 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/slider/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | &-base, 3 | &-disabled, 4 | &-label, 5 | &-capsule { 6 | background: var(--td-bg-color-container); 7 | padding: 18px 0; 8 | } 9 | 10 | &-capsule { 11 | padding: 16px 0; 12 | } 13 | 14 | &-capsule, 15 | &-disabled, 16 | &-label { 17 | margin-top: 16px; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/slider/constants.ts: -------------------------------------------------------------------------------- 1 | export const BLOCK_SIZE = 20; 2 | 3 | export const BORDER_WIDTH = 6; 4 | -------------------------------------------------------------------------------- /src/slider/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSliderProps } from './type'; 6 | 7 | export const sliderDefaultProps: TdSliderProps = { 8 | disabled: undefined, 9 | label: false, 10 | max: 100, 11 | min: 0, 12 | range: false, 13 | showExtremeValue: false, 14 | step: 1, 15 | theme: 'default', 16 | defaultValue: 0, 17 | }; 18 | -------------------------------------------------------------------------------- /src/slider/index.tsx: -------------------------------------------------------------------------------- 1 | import _Slider from './Slider'; 2 | import './style/index.js'; 3 | 4 | export type { SliderProps } from './Slider'; 5 | export * from './type'; 6 | 7 | export const Slider = _Slider; 8 | export default Slider; 9 | -------------------------------------------------------------------------------- /src/slider/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/slider/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/slider/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/stepper/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Stepper } from 'tdesign-mobile-react'; 3 | 4 | export default function Base() { 5 | return ( 6 |
7 | 8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/stepper/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Stepper } from 'tdesign-mobile-react'; 3 | 4 | export default function StepperSize() { 5 | const [value, setValue] = useState(3); 6 | 7 | const handleChange = ($event: number) => { 8 | setValue($event); 9 | console.log(`change to ${$event}`); 10 | }; 11 | 12 | return ( 13 |
14 | 15 | 16 | 17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/stepper/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Stepper } from 'tdesign-mobile-react'; 3 | 4 | export default function StatusStepper() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/stepper/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .stepper-container { 2 | margin-bottom: 28px; 3 | } 4 | 5 | .stepper-example { 6 | padding: 16px; 7 | display: grid; 8 | grid-template-columns: repeat(3, 1fr); 9 | gap: 24px; 10 | background-color: var(--td-bg-color-container); 11 | } 12 | -------------------------------------------------------------------------------- /src/stepper/_example/theme.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Stepper } from 'tdesign-mobile-react'; 3 | 4 | export default function theme() { 5 | return ( 6 |
7 | 8 | 9 | 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/stepper/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdStepperProps } from './type'; 6 | 7 | export const stepperDefaultProps: TdStepperProps = { 8 | disableInput: false, 9 | disabled: undefined, 10 | integer: true, 11 | max: 100, 12 | min: 0, 13 | size: 'medium', 14 | step: 1, 15 | theme: 'normal', 16 | defaultValue: 0, 17 | }; 18 | -------------------------------------------------------------------------------- /src/stepper/index.tsx: -------------------------------------------------------------------------------- 1 | import _Stepper from './Stepper'; 2 | import './style'; 3 | 4 | export * from './type'; 5 | export type { StepperProps } from './Stepper'; 6 | 7 | export const Stepper = _Stepper; 8 | export default Stepper; 9 | -------------------------------------------------------------------------------- /src/stepper/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; -------------------------------------------------------------------------------- /src/stepper/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/stepper/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/steps/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .steps-horizontal-demo-block { 2 | margin: 16px 0 24px; 3 | padding: 16px 0; 4 | background-color: #fff; 5 | } 6 | .steps-vertical-demo-block { 7 | margin: 16px 0 24px; 8 | padding: 16px; 9 | background-color: #fff; 10 | } 11 | -------------------------------------------------------------------------------- /src/steps/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdStepsProps, TdStepItemProps } from './type'; 6 | 7 | export const stepsDefaultProps: TdStepsProps = { 8 | currentStatus: 'process', 9 | layout: 'horizontal', 10 | readonly: undefined, 11 | sequence: 'positive', 12 | theme: 'default', 13 | }; 14 | 15 | export const stepItemDefaultProps: TdStepItemProps = { 16 | content: '', 17 | icon: true, 18 | status: 'default', 19 | title: '', 20 | titleRight: '', 21 | }; 22 | -------------------------------------------------------------------------------- /src/steps/index.tsx: -------------------------------------------------------------------------------- 1 | import _Steps from './Steps'; 2 | import _StepItem from './StepItem'; 3 | 4 | import './style'; 5 | 6 | export type { StepsProps } from './Steps'; 7 | export type { StepItemProps } from './StepItem'; 8 | export * from './type'; 9 | 10 | export const Steps = _Steps; 11 | (Steps as any).StepItem = _StepItem; 12 | export const StepItem = _StepItem; 13 | 14 | export default Steps; 15 | -------------------------------------------------------------------------------- /src/steps/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/steps/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/steps/v2/_index.less'; 2 | import '../../_common/style/mobile/components/step-item/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/sticky/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Sticky, Button } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Base() { 6 | return ( 7 |
8 | 9 | 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/sticky/_example/container.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Sticky, Button } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Base() { 6 | return ( 7 |
8 | 9 | 10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/sticky/_example/offset.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Sticky, Button } from 'tdesign-mobile-react'; 3 | import './style/index.less'; 4 | 5 | export default function Base() { 6 | return ( 7 |
8 | 9 | 12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/sticky/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-demo-block-wrap { 2 | height: 1000px; 3 | 4 | .tdesign-demo-block-1 { 5 | padding-left: 16px; 6 | } 7 | 8 | .tdesign-demo-block-2 { 9 | padding-left: 136px; 10 | 11 | } 12 | .tdesign-demo-block-3 { 13 | background-color: #fff; 14 | height: 144px; 15 | padding-left: 256px; 16 | } 17 | 18 | .custom-common-button { 19 | color: #fff; 20 | width: 104px; 21 | height: 44px; 22 | } 23 | 24 | .custom-button { 25 | background-color: #00A870; 26 | } 27 | } -------------------------------------------------------------------------------- /src/sticky/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdStickyProps } from './type'; 6 | 7 | export const stickyDefaultProps: TdStickyProps = { container: 'body', disabled: false, offsetTop: 0, zIndex: 99 }; 8 | -------------------------------------------------------------------------------- /src/sticky/hooks/useBoundingClientRect.ts: -------------------------------------------------------------------------------- 1 | export default function useBoundingClientRect(dom: Element) { 2 | const { top, height } = dom.getBoundingClientRect(); 3 | return { 4 | top, 5 | height 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sticky/index.tsx: -------------------------------------------------------------------------------- 1 | import _Sticky from './Sticky'; 2 | import { TdStickyProps } from './type'; 3 | import './style'; 4 | 5 | export const Sticky = _Sticky; 6 | export type StickyProps = TdStickyProps; 7 | 8 | export default Sticky; 9 | -------------------------------------------------------------------------------- /src/sticky/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/sticky/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/sticky/_index.less'; -------------------------------------------------------------------------------- /src/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/style/index.js: -------------------------------------------------------------------------------- 1 | import '../_common/style/mobile/theme/_index.less'; 2 | -------------------------------------------------------------------------------- /src/swipe-cell/_example/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TDemoHeader from '../../../site/mobile/components/DemoHeader'; 3 | import Left from './left'; 4 | import Right from './right'; 5 | import Double from './double'; 6 | import Icon from './icon'; 7 | import Event from './event'; 8 | 9 | import './style/base.less'; 10 | 11 | export default function SwipeCellDemo() { 12 | return ( 13 |
14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/swipe-cell/_example/right.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SwipeCell, Cell, Toast } from 'tdesign-mobile-react'; 3 | import TDemoBlock from '../../../site/mobile/components/DemoBlock'; 4 | 5 | export default function Demo() { 6 | const handleClick = (message = 'click') => { 7 | Toast({ 8 | message, 9 | }); 10 | }; 11 | 12 | const oneButton = ( 13 |
handleClick()}> 14 | 选择 15 |
16 | ); 17 | 18 | return ( 19 | 20 | } opened /> 21 | 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/swipe-cell/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSwipeCellProps } from './type'; 6 | 7 | export const swipeCellDefaultProps: TdSwipeCellProps = { opened: false }; 8 | -------------------------------------------------------------------------------- /src/swipe-cell/index.ts: -------------------------------------------------------------------------------- 1 | import _SwipeCell from './SwipeCell'; 2 | import './style'; 3 | 4 | export type { SwipeCellProps, SwipeCellRef } from './SwipeCell'; 5 | export * from './type'; 6 | 7 | export const SwipeCell = _SwipeCell; 8 | export default SwipeCell; 9 | -------------------------------------------------------------------------------- /src/swipe-cell/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/swipe-cell/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/swipe-cell/v2/_index.less'; 2 | 3 | import './index.less'; 4 | -------------------------------------------------------------------------------- /src/swipe-cell/style/index.less: -------------------------------------------------------------------------------- 1 | @import '../../_common/style/mobile/base.less'; 2 | 3 | .@{prefix}-swipe-cell { 4 | &__wrapper { 5 | transition: transform 0.3s ease-in-out; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/swiper/SwiperContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { RefObject } from 'react'; 2 | 3 | export interface SwiperItemReference { 4 | divRef: RefObject; 5 | updateTranslateStyle: (style: string) => void; 6 | updateClassNameSuffix: (extraClassName: string) => void; 7 | } 8 | 9 | interface SwiperContextProps { 10 | addChild?: (ref: SwiperItemReference) => void; 11 | removeChild?: (divRef: RefObject) => void; 12 | forceContainerHeight?: (height: number | string) => void; 13 | } 14 | 15 | const SwiperContext = React.createContext({}); 16 | 17 | export default SwiperContext; 18 | -------------------------------------------------------------------------------- /src/swiper/_example/test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Swiper } from 'tdesign-mobile-react'; 3 | 4 | export default function () { 5 | return ( 6 | <> 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/swiper/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSwiperProps } from './type'; 6 | 7 | export const swiperDefaultProps: TdSwiperProps = { 8 | animation: 'slide', 9 | autoplay: true, 10 | current: 0, 11 | direction: 'horizontal', 12 | duration: 300, 13 | interval: 5000, 14 | loop: true, 15 | nextMargin: 0, 16 | previousMargin: 0, 17 | type: 'default', 18 | }; 19 | -------------------------------------------------------------------------------- /src/swiper/index.tsx: -------------------------------------------------------------------------------- 1 | import './style/index'; 2 | import _Swiper from './Swiper'; 3 | 4 | export type { SwiperProps } from './Swiper'; 5 | export * from './type'; 6 | 7 | export const Swiper = _Swiper; 8 | export default Swiper; 9 | -------------------------------------------------------------------------------- /src/swiper/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/swiper/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/swiper/v2/_index.less'; 2 | import '../../_common/style/mobile/components/swiper-nav/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/switch/_example/base.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Switch, Cell } from 'tdesign-mobile-react'; 3 | import type { SwitchValue } from 'tdesign-mobile-react'; 4 | 5 | export default function SwitchBase() { 6 | const [checked, setChecked] = useState(1); 7 | 8 | const onChange = (value: SwitchValue) => { 9 | console.log('value', value); 10 | setChecked(value); 11 | }; 12 | 13 | return ( 14 | <> 15 | }> 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/switch/_example/color.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Switch, Cell } from 'tdesign-mobile-react'; 3 | 4 | export default function SwitchColor() { 5 | return ( 6 | <> 7 | }> 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/switch/_example/size.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Switch, Cell } from 'tdesign-mobile-react'; 3 | 4 | export default function SwitchSize() { 5 | return ( 6 | <> 7 | }> 8 | }> 9 | }> 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/switch/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Switch, Cell } from 'tdesign-mobile-react'; 3 | 4 | export default function SwitchStatus() { 5 | return ( 6 | <> 7 | }> 8 | }> 9 | 10 |
禁用状态
11 | 12 | }> 13 | }> 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/switch/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .custom-color { 2 | --td-switch-checked-color: #00a870; 3 | } 4 | 5 | .t-cell + .t-cell { 6 | margin-top: 16px; 7 | } 8 | 9 | .demo__title { 10 | margin: 24px 16px 16px; 11 | color: var(--td-text-color-secondary, rgba(0, 0, 0, 0.6)); 12 | font-size: 14px; 13 | line-height: 22px; 14 | } 15 | -------------------------------------------------------------------------------- /src/switch/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdSwitchProps } from './type'; 6 | 7 | export const switchDefaultProps: TdSwitchProps = { disabled: undefined, label: [], loading: false, size: 'medium' }; 8 | -------------------------------------------------------------------------------- /src/switch/index.ts: -------------------------------------------------------------------------------- 1 | import _Switch from './Switch'; 2 | import './style'; 3 | 4 | export type { SwitchProps } from './Switch'; 5 | export * from './type'; 6 | 7 | export const Switch = _Switch; 8 | export default Switch; 9 | -------------------------------------------------------------------------------- /src/switch/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/switch/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/switch/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/tab-bar/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .tdesign-mobile-demo { 2 | .t-tab-bar { 3 | position: relative; 4 | } 5 | .t-tab-bar + .t-tab-bar { 6 | margin-top: 16px; 7 | } 8 | 9 | .section { 10 | &-custom { 11 | --td-tab-bar-border-color: #e7e7e7; 12 | --td-tab-bar-bg-color: #eee; 13 | --td-tab-bar-hover-color: #ddd; 14 | --td-tab-bar-item-color: #bbb; 15 | --td-tab-bar-item-active-color: #333; 16 | } 17 | } 18 | } 19 | 20 | :root[theme-mode='dark'] { 21 | .tdesign-mobile-demo { 22 | .section { 23 | &-custom { 24 | --td-tab-bar-color: rgba(0, 0, 0, 0.9); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/tab-bar/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdTabBarProps } from './type'; 6 | 7 | export const tabBarDefaultProps: TdTabBarProps = { 8 | bordered: true, 9 | fixed: true, 10 | safeAreaInsetBottom: true, 11 | shape: 'normal', 12 | split: true, 13 | theme: 'normal', 14 | defaultValue: undefined, 15 | }; 16 | -------------------------------------------------------------------------------- /src/tab-bar/index.ts: -------------------------------------------------------------------------------- 1 | import _TabBar from './TabBar'; 2 | import _TabBarItem from './TabBarItem'; 3 | 4 | import './style/index.js'; 5 | 6 | export type { TabBarProps } from './TabBar'; 7 | export type { TabBarItemProps } from './TabBarItem'; 8 | export * from './type'; 9 | 10 | export const TabBar = _TabBar; 11 | export const TabBarItem = _TabBarItem; 12 | export default { 13 | TabBar, 14 | TabBarItem, 15 | }; 16 | -------------------------------------------------------------------------------- /src/tab-bar/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/tab-bar/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/tab-bar/v2/_index.less'; 2 | import '../../_common/style/mobile/components/tab-bar-item/v2/_index.less'; 3 | -------------------------------------------------------------------------------- /src/tab-bar/useTabBarCssTransition.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | 3 | type useTabBarCssTransitionProps = { 4 | name: string; 5 | }; 6 | 7 | function useTabBarCssTransition(props: useTabBarCssTransitionProps) { 8 | const { name } = props; 9 | 10 | return useMemo( 11 | () => ({ 12 | enter: `${name}-enter-from`, 13 | enterActive: `${name}-enter-active`, 14 | enterDone: `${name}-enter-active`, 15 | 16 | exit: `${name}-leave-active`, 17 | exitActive: `${name}-leave-to`, 18 | exitDone: `${name}-leave-to`, 19 | }), 20 | [name], 21 | ); 22 | } 23 | 24 | export default useTabBarCssTransition; 25 | -------------------------------------------------------------------------------- /src/table/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdBaseTableProps } from './type'; 6 | 7 | export const baseTableDefaultProps: TdBaseTableProps = { 8 | bordered: false, 9 | columns: [], 10 | data: [], 11 | empty: '', 12 | loading: undefined, 13 | rowKey: 'id', 14 | showHeader: true, 15 | stripe: false, 16 | tableLayout: 'fixed', 17 | verticalAlign: 'middle', 18 | }; 19 | -------------------------------------------------------------------------------- /src/table/index.tsx: -------------------------------------------------------------------------------- 1 | import { BaseTable, BaseTableProps } from './BaseTable'; 2 | 3 | import './style'; 4 | 5 | export type TableProps = BaseTableProps; 6 | 7 | export { BaseTable as Table }; 8 | 9 | export default BaseTable; 10 | -------------------------------------------------------------------------------- /src/table/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/table/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/table/_index.less'; 2 | -------------------------------------------------------------------------------- /src/tabs/_example/badge.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Tabs, TabPanel } from 'tdesign-mobile-react'; 3 | 4 | export default () => ( 5 |
6 | 7 | 8 | 9 | 10 | 11 |
12 | ); 13 | -------------------------------------------------------------------------------- /src/tabs/_example/status.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Tabs, TabPanel } from 'tdesign-mobile-react'; 3 | 4 | export default () => ( 5 |
6 | 7 | 8 | 9 | 10 | 11 |
12 | ); 13 | -------------------------------------------------------------------------------- /src/tabs/_example/style/index.less: -------------------------------------------------------------------------------- 1 | .t-tabs { 2 | margin-bottom: 16px; 3 | } 4 | .label-content { 5 | display: flex; 6 | align-items: center; 7 | justify-content: center; 8 | 9 | span { 10 | margin-left: 3px; 11 | } 12 | } 13 | 14 | .t-tabs__panel p { 15 | height: 120px; 16 | align-items: center; 17 | justify-content: center; 18 | display: flex; 19 | color: var(--td-text-color-secondary, rgba(#000000, 0.66)); 20 | margin: 0; 21 | font-size: 14px; 22 | font-weight: 400; 23 | } 24 | -------------------------------------------------------------------------------- /src/tabs/context.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const TabContext = React.createContext(null); 4 | 5 | export default TabContext; 6 | -------------------------------------------------------------------------------- /src/tabs/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdTabsProps, TdTabPanelProps } from './type'; 6 | 7 | export const tabsDefaultProps: TdTabsProps = { 8 | bottomLineMode: 'fixed', 9 | showBottomLine: true, 10 | size: 'medium', 11 | spaceEvenly: true, 12 | sticky: false, 13 | swipeable: true, 14 | theme: 'line', 15 | }; 16 | 17 | export const tabPanelDefaultProps: TdTabPanelProps = { destroyOnHide: true, disabled: false, lazy: false }; 18 | -------------------------------------------------------------------------------- /src/tabs/index.ts: -------------------------------------------------------------------------------- 1 | import _Tabs from './Tabs'; 2 | import _TabPanel from './TabPanel'; 3 | 4 | import './style'; 5 | 6 | export const Tabs = _Tabs; 7 | export const TabPanel = _TabPanel; 8 | 9 | export default Tabs; 10 | -------------------------------------------------------------------------------- /src/tabs/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/tabs/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/tabs/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/tag/defaultProps.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC 3 | * */ 4 | 5 | import { TdTagProps, TdCheckTagProps } from './type'; 6 | 7 | export const tagDefaultProps: TdTagProps = { 8 | closable: false, 9 | disabled: false, 10 | icon: undefined, 11 | shape: 'square', 12 | size: 'medium', 13 | theme: 'default', 14 | variant: 'dark', 15 | }; 16 | 17 | export const checkTagDefaultProps: TdCheckTagProps = { 18 | defaultChecked: undefined, 19 | closable: false, 20 | disabled: false, 21 | shape: 'square', 22 | size: 'medium', 23 | variant: 'dark', 24 | }; 25 | -------------------------------------------------------------------------------- /src/tag/index.ts: -------------------------------------------------------------------------------- 1 | import _Tag from './Tag'; 2 | import _CheckTag from './CheckTag'; 3 | 4 | import './style/index.js'; 5 | 6 | export type { TagProps } from './Tag'; 7 | export * from './type'; 8 | 9 | export const Tag = _Tag; 10 | export const TagCheck = _CheckTag; 11 | export default { 12 | Tag, 13 | TagCheck, 14 | }; 15 | -------------------------------------------------------------------------------- /src/tag/style/css.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /src/tag/style/index.js: -------------------------------------------------------------------------------- 1 | import '../../_common/style/mobile/components/tag/v2/_index.less'; 2 | -------------------------------------------------------------------------------- /src/textarea/_example/autosize.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Textarea } from 'tdesign-mobile-react'; 3 | 4 | export default function Autosize() { 5 | return