Skip to content

Commit ece2b7e

Browse files
committed
docs: update common docs
1 parent f4cee75 commit ece2b7e

14 files changed

+609
-134
lines changed

src/sites/sites-react/doc/docs/react/intro-react.en-US.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The NutUI-React component library is suitable for H5 applications of the React t
55
## Features
66

77
- 🚀 80+ high-quality components covering mainstream mobile scenarios
8-
- 📖 Based on JD APP 10.0 visual specification
8+
- 📖 Based on JD APP 15.0 visual specification
99
- 🍭 Support on-demand reference
1010
- 📖 Detailed documentation and examples
1111
- 💪 Supports TypeScript
@@ -23,7 +23,7 @@ The NutUI-React component library is suitable for H5 applications of the React t
2323

2424
| Version | Supported Frameworks | Visual Specifications | Compatibility |
2525
| --- | --- | --- | --- |
26-
| @nutui/nutui-react <img src="https://img.shields.io/npm/v/@nutui/nutui-react" /> | React 17\18 | Jingdong [APP 10.0](#/resource) | Modern browsers start with Chrome >= 51、iOS >= 10.0 |
26+
| @nutui/nutui-react <img src="https://img.shields.io/npm/v/@nutui/nutui-react" /> | React 17\18 | Jingdong APP 15.0 | Modern browsers start with Chrome >= 51、iOS >= 10.0 |
2727

2828
For some older versions of browsers, corresponding polyfills are needed. It is recommended to use @babel/preset-env to address browser compatibility issues. The package provided by NutUI-React has not undergone extensive syntax transformation, so it is necessary to include the NutUI-React package in the compilation phase.
2929

src/sites/sites-react/doc/docs/react/intro-react.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ NutUI-React 组件库,适用于 React 技术栈的 H5 应用,开箱即用,
55
## 特性
66

77
- 🚀 80+ 高质量组件,覆盖移动端主流场景
8-
- 📖 基于京东APP 10.0 视觉规范
8+
- 📖 基于京东APP 15.0 视觉规范
99
- 🍭 支持按需引用
1010
- 📖 详尽的文档和示例
1111
- 💪 支持 TypeScript
@@ -23,7 +23,7 @@ NutUI-React 组件库,适用于 React 技术栈的 H5 应用,开箱即用,
2323

2424
| 版本 | 支持的框架 | 视觉规范 | 兼容 |
2525
| --- | --- | --- | --- |
26-
| @nutui/nutui-react <img src="https://img.shields.io/npm/v/@nutui/nutui-react" /> | React 17\18 | 京东 [APP 10.0](#/resource) 规范 | 现代浏览器以 Chrome >= 51、iOS >= 10.0 |
26+
| @nutui/nutui-react <img src="https://img.shields.io/npm/v/@nutui/nutui-react" /> | React 17\18 | 京东 APP 15.0 规范 | 现代浏览器以 Chrome >= 51、iOS >= 10.0 |
2727

2828
对于一些低版本的浏览器,需要相应的 Ployfill,建议使用 @babel/preset-environment 来解决浏览器兼容问题。NutUI-React 提供的包并未进行过多的语法转换,所以需要将 NutUI-React 包含到编译阶段。
2929

Lines changed: 233 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,277 @@
1-
# Upgrading from v2 to v3
1+
# Upgrade from v2 to v3.
22

3-
This document will help you upgrade from NutUI React `2.x` to NutUI React `3.x` version.
3+
This document will assist you in upgrading from NutUI React 2.x to NutUI React 3.x.
44

55
## Upgrade Steps
66

7-
1. H5 Install NutUI React version 3.x
7+
1. H5 Installation of NutUI React 3.x Version
88

99
```shell
1010
npm install @nutui/nutui-react
1111
```
1212

13-
2. Taro installs NutUI React version 3.x
13+
2. Taro Installation of NutUI React 3.x Version
1414

1515
```shell
1616
npm install @nutui/nutui-react-taro
1717
```
1818

19-
3. Handling incompatible updates
19+
3. Handling Incompatible Updates
2020

21-
There are some incompatible updates from NutUI React 1.x to NutUI React 2.x. You need to read the incompatible updates carefully and deal with them in turn.
21+
There are some incompatible updates from NutUI React 2.x to NutUI React 3.x. It is essential to carefully read the details of the incompatible updates and address them sequentially.
2222

23-
You can manually check your code against the list below to make changes, or we provide a codemod cli tool @nutui/nutui-react-codemod to help you upgrade to v2 quickly. Please commit your local code changes before running codemod cli.
23+
4. Theme variable renaming:
2424

25-
4. Theme variables are renamed:
26-
For example, primary-color is renamed to color-primary; note that if you are using a custom theme, especially if you are using the ConfigProvider component, you are not using `nutuiBrandColor`, remember to rename it to `nutuiColorPrimary`.
25+
## Compatible updates
2726

28-
## Compatibility Updates
27+
1. Component Style Handling
2928

30-
1. Component style handling
31-
32-
Added support for importing css files on demand, while retaining the ability to import scss files on demand. On-demand css import can be realized by babel-import-plugin plugin:
29+
Support for on-demand importing of CSS files has been added, while retaining the ability to import SCSS files on demand. On-demand CSS importing can be achieved using the babel-import-plugin:
3330

3431
The H5 configuration is as follows:
3532

36-
```js
37-
// Webpack .babelrc or babel.config.js configuration
33+
```json
34+
// Webpack .babelrc or babel.config.js
3835
plugins: [
3936
[
40-
import”.
37+
"import",
4138
{
42-
libraryName: @nutui/nutui-react”, libraryDirectory: “dist/esm”, {
43-
libraryDirectory: dist/esm”, {
39+
libraryName: "@nutui/nutui-react",
40+
libraryDirectory: "dist/esm",
4441
style: 'css',
4542
camel2DashComponentName: false,
46-
}.
47-
“nutui-react”.
43+
"customName": (name, file) => {
44+
return `@nutui/nutui-react-taro/dist/es/packages/${name.toLowerCase()}`
45+
}
46+
},
47+
"nutui-react",
4848
]
4949
]
5050
```
5151

52-
Taro is configured as follows:
52+
Taro config:
5353

5454
```json
55-
// Configured in Webpack .babelrc or babel.config.js
55+
// Webpack .babelrc or babel.config.js
5656
plugins: [
5757
[
58-
import”.
58+
"import",
5959
{
60-
libraryName: @nutui/nutui-react-taro”, libraryDirectory: “dist/esm”, {
61-
libraryDirectory: dist/esm”, {
60+
libraryName: "@nutui/nutui-react-taro",
61+
libraryDirectory: "dist/esm",
6262
style: 'css',
6363
camel2DashComponentName: false,
64-
}.
65-
“nutui-react-taro”.
64+
"customName": (name, file) => {
65+
return `@nutui/nutui-react-taro/dist/es/packages/${name.toLowerCase()}`
66+
}
67+
},
68+
"nutui-react-taro",
6669
]
6770
]
6871
```
6972

70-
2. better type exporting and adding `JSDoc` annotations to types
71-
3. Adjustment of component categorization
72-
In terms of component classification, we have reviewed the 1.x classification based on the information structure from the interaction dimension, together with the interaction design side, and subclassed and reclassified them, with the goal of more closely matching the distribution of interaction scenarios and making it easy to find components. The main distribution is:
73+
## New Components
74+
75+
- SideBar
76+
- PickerView
77+
78+
## Incompatible Updates
79+
80+
If your project uses these components, please read the documentation carefully and proceed with the upgrade.
81+
82+
## Component API Adjustments
83+
84+
### Basic
85+
86+
#### Button
87+
88+
- Removed style variable `--nutui-button-default-font-weight`
89+
90+
[//]: # '#### Cell'
91+
[//]: # '#### CellGroup'
92+
[//]: # '#### ConfigProvider'
93+
[//]: # '#### Icon'
94+
[//]: # '#### Image'
95+
[//]: # '#### Overlay'
96+
[//]: # '#### Popup'
97+
98+
### Layout
99+
100+
[//]: # '#### Divider'
101+
102+
#### Grid
103+
104+
- The default value of the square attribute has been adjusted to true.
105+
- Added new theme variables.
106+
- `--nutui-grid-border-width` Control border width.
107+
- `--nutui-grid-border-radius` Control corner radius.
108+
-
109+
110+
[//]: # '#### Layout'
111+
[//]: # '#### Sticky'
112+
113+
### Navigation
114+
115+
[//]: # '#### Elevator'
116+
[//]: # '#### FixedNav'
117+
118+
#### Indicator
119+
120+
- Added a new type attribute with optional values of 'anchor' or 'slide', defaulting to anchor.
121+
- Added a new color attribute with optional values of primary or 'white', defaulting to primary.
122+
- The default value of the total attribute has been adjusted to 2.
123+
124+
[//]: # '#### Menu'
125+
126+
#### NavBar
127+
128+
- Removed the titleAlign attribute; it can be replaced with title and children.
129+
- Added a title attribute, which is displayed centered by default.
130+
- If children is present in the component, it will adopt the left alignment layout specified by titleAlign.
131+
132+
#### Pagination
133+
134+
- The type of the itemRender attribute has been adjusted to: (page: any, index: number) => ReactNode.
135+
136+
#### SideNavBar
137+
138+
- Note: This component does not comply with mobile standards and has been deprecated. Please use SideBar instead.
139+
140+
[//]: # '#### Tabbar'
141+
[//]: # '#### TabbarItem'
142+
[//]: # '#### Tabs'
143+
[//]: # '#### Tabs.Tabpane'
144+
145+
### Data
146+
147+
[//]: # '#### Calendar'
148+
[//]: # '#### Cascader'
149+
[//]: # '#### Checkbox'
150+
[//]: # '#### Checkbox.Group'
151+
[//]: # '#### DatePicker'
152+
[//]: # '#### Form'
153+
[//]: # '#### Form.Item'
154+
[//]: # '#### Input'
155+
[//]: # '#### InputNumber'
156+
[//]: # '#### NumberKeyboard'
157+
[//]: # '#### Picker'
158+
[//]: # '#### Radio'
159+
[//]: # '### Radio.Group'
160+
[//]: # '#### Range'
161+
162+
#### Rate
163+
164+
- Added a size attribute to control the size of the icon.
165+
- Added a showScore attribute to display the rating text.
166+
167+
[//]: # '#### SearchBar'
168+
[//]: # '#### ShortPassword'
169+
170+
#### TextArea
171+
172+
- Added a plain attribute to mark it as a plain text type. The default value is false, indicating it is a container type.
173+
- Added a status attribute, with possible values of default | error, to define the state of the input box.
174+
- Removed some basic style variables and recommended using foundational style variables, such as $textarea-font, $textarea-limit-color, and $textarea-disabled-color.
175+
176+
#### Uploader
177+
178+
- Removed internal handling of AJAX-related network logic in the component.
179+
- Removed network configuration-related props: url, headers, data, xhrState, withCredentials, and timeout.
180+
- Removed trigger functions related props: onStart, onProgress, onFailure, and beforeXhrUpload.
181+
- Added the onOverCount attribute to trigger when the file count exceeds the limit.
182+
- Added the onUploadQueueChange attribute to trigger when the image upload queue changes.
183+
- Simplified the use of the FileItem type, making all attributes optional except for url.
184+
- Adjusted the default value of the maxCount attribute in multi-select mode to Number.MAX_VALUE.
185+
- Introduced a new upload method.
186+
- Changed the types of defaultValue and value from FileType to FileItem.
187+
188+
### Feedback
189+
190+
[//]: # '#### ActionSheet'
191+
192+
#### BackTop
193+
194+
- Taro
195+
- Provided HarmonyOS capabilities by adding the scrollRes attribute.
196+
197+
#### Dialog
198+
199+
- Modified the layout style of the operation buttons to have a vertical arrangement.
200+
- When there is only one main action button, its style expands to fill the available space.
201+
- Added style variables for setting the size of bottom icons; changed the default value of the right-side button to 16 px.
202+
203+
[//]: # '#### Drag'
204+
205+
#### InfiniteLoading
206+
207+
- The target attribute is used to obtain the element that is being listened to.
208+
209+
[//]: # '#### Notify'
210+
[//]: # '#### PullToRefresh'
211+
[//]: # '#### Swipe'
212+
213+
#### Switch
214+
215+
- Changed the type of the activeText attribute to ReactNode.
216+
- Changed the type of the inactiveText attribute to ReactNode.
217+
218+
[//]: # '#### Toast'
219+
220+
[//]: ### 展示组件
221+
222+
[//]: # '#### Animate'
223+
[//]: # '#### AnimatingNumbers'
224+
225+
#### Audio
226+
227+
- Note: This component is not planned to be supported on Taro multi-end. Please use the API instead.
228+
229+
[//]: # '#### Avatar'
230+
[//]: # '#### AvatarGroup'
231+
232+
#### Badge
233+
234+
- Added a new size attribute for the dot size, which takes effect when dot is set to true.
235+
- Removed the color attribute (badge background color) and implemented it using the CSS variable --nutui-badge-background-color.
236+
237+
[//]: # '#### CircleProgress'
238+
[//]: # '#### Collapse'
239+
[//]: # '#### CollapseItem'
240+
241+
#### CountDown
242+
243+
- Added a new type attribute to set the variant type.
244+
245+
[//]: # '#### Ellipsis'
246+
247+
#### Empty
248+
249+
- Removed the theme variable --nutui-empty-title-margin-top.
250+
- Removed the theme variable --nutui-empty-description-margin-top.
251+
252+
[//]: # '#### ImagePreview'
253+
[//]: # '#### NoticeBar'
254+
[//]: # '#### Popover'
255+
256+
#### Price
73257

74-
- Basic components, remove the `Popup` component, and subdivide `Popup` into operation feedback-guidance tips section;
75-
- Layout components, remain unchanged;
76-
- Navigation components: move `Pagination` and `Indicator` to the display component (considering the light operation of paging on mobile); move `Menu` menu to the data entry class-selector subclass (considering the light operation of paging on mobile); move `Menu` to the data entry class-selector subclass (considering the light operation of paging on mobile).
258+
- Modified the size attribute to include an 'xlarge' option.
259+
- Added a new color attribute for price types.
77260

78-
Translated with DeepL.com (free version)
261+
[//]: # '#### Progress'
262+
[//]: # '#### Skeleton'
263+
[//]: # '#### Steps'
264+
[//]: # '#### Step'
265+
[//]: # '#### Swiper'
266+
[//]: # '#### Table'
267+
[//]: # '#### Tag'
268+
[//]: # '#### TrendArrow'
269+
[//]: # '#### Video'
270+
[//]: # '#### VirtualList'
271+
[//]: # '#### WaterMark'
272+
[//]: # '### 特色组件'
273+
[//]: # '#### Address'
274+
[//]: # '#### Barrage'
275+
[//]: # '#### Card'
276+
[//]: # '#### Signature'
277+
[//]: # '#### TimeSelect'

src/sites/sites-react/doc/docs/react/official-theme-react.en-US.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ NutUI provides multiple sets of official `UI` themes by default, while allowing
99
| theme description | scss file name |
1010
| --- | --- |
1111
| Jingdong APP 10.0 theme (default) | `variables.scss` |
12-
| Jingdong B Mall Theme <a target="_blank" href="https://nutui.jd.com/h5/vue/4x/?jdb#/zh-CN/component/button" >Preview</a> | `variables-jdb.scss ` |
13-
14-
<img src="https://img12.360buyimg.com/imagetools/jfs/t1/157759/16/13989/142151/6052efc7Ef8f4bff4/f3dd6422949ba4b7.jpg" width="700" alt="NutUI theme customization"/>
12+
| Jingdong JDesign Theme | `variables-jdb.scss ` |
1513

1614
## How to use
1715

@@ -31,7 +29,7 @@ export default defineConfig({
3129
preprocessorOptions: {
3230
scss: {
3331
// Default Jingdong APP 10.0 theme > @import "@nutui/nutui-react/dist/styles/variables.scss";
34-
// Jingdong B Mall theme > @import "@nutui/nutui-react/dist/styles/variables-jdb.scss";
32+
// Jingdong B Mall theme > @import "@nutui/nutui-react/dist/styles/variables-jmapp.scss";
3533
additionalData: `@import "@nutui/nutui-react/dist/styles/variables.scss";`,
3634
},
3735
},

src/sites/sites-react/doc/docs/react/official-theme-react.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ NutUI 默认提供多套官方`UI`主题,同时允许在一定程度上定制
99
| 主题说明 | scss 文件名称 |
1010
| --- | --- |
1111
| 京东 APP 主题(默认) | `variables.scss` |
12-
| 京东B商城主题<a target="_blank" href="https://nutui.jd.com/h5/vue/4x/?jdb#/zh-CN/component/button" >预览</a> | `variables-jdb.scss` |
13-
14-
<img src="https://img12.360buyimg.com/imagetools/jfs/t1/157759/16/13989/142151/6052efc7Ef8f4bff4/f3dd6422949ba4b7.jpg" width="700" alt="NutUI 主题定制"/>
12+
| 京东 JDesign 主题 | `variables-jmapp.scss` |
1513

1614
## 使用方式
1715

@@ -31,7 +29,7 @@ export default defineConfig({
3129
preprocessorOptions: {
3230
scss: {
3331
// 默认京东 APP 主题 > @import "@nutui/nutui-react/dist/styles/variables.scss";
34-
// 京东B商城主题 > @import "@nutui/nutui-react/dist/styles/variables-jdb.scss";
32+
// 京东B商城主题 > @import "@nutui/nutui-react/dist/styles/variables-jmapp.scss";
3533
additionalData: `@import "@nutui/nutui-react/dist/styles/variables.scss";`,
3634
},
3735
},

src/sites/sites-react/doc/docs/react/theme-react.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
NutUI-React supports flexible style customization to meet multiple visual business and brand needs, including but not limited to support for global master tone and component-specific visual customization.
66
<br />
77
<br />
8-
In NutUI-React version 2.0, the Sass theme customization function of 1.x can still be used. We added CSS variables to the original theme customization function, so that the new theme customization function can be used without introducing additional SCSS style files.
8+
In NutUI-React, the Sass theme customization function can still be used. We added CSS variables to the original theme customization function, so that the new theme customization function can be used without introducing additional SCSS style files.
99

1010
## Method 1: Use CSS Variables to configure topics
1111

0 commit comments

Comments
 (0)