@mijadesign/nut-mcp 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +147 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +16 -0
  4. package/dist/services/aliases.service.d.ts +1 -0
  5. package/dist/services/aliases.service.js +19 -0
  6. package/dist/services/doc-parser.service.d.ts +3 -0
  7. package/dist/services/doc-parser.service.js +162 -0
  8. package/dist/services/index.services.d.ts +3 -0
  9. package/dist/services/index.services.js +71 -0
  10. package/dist/services/paths.service.d.ts +5 -0
  11. package/dist/services/paths.service.js +18 -0
  12. package/dist/tools/base.tool.d.ts +8 -0
  13. package/dist/tools/base.tool.js +27 -0
  14. package/dist/tools/get-component-doc.tool.d.ts +12 -0
  15. package/dist/tools/get-component-doc.tool.js +40 -0
  16. package/dist/tools/index.d.ts +4 -0
  17. package/dist/tools/index.js +4 -0
  18. package/dist/tools/list-components.tool.d.ts +8 -0
  19. package/dist/tools/list-components.tool.js +32 -0
  20. package/dist/tools/search-components.tool.d.ts +12 -0
  21. package/dist/tools/search-components.tool.js +61 -0
  22. package/dist/types/index.d.ts +33 -0
  23. package/dist/types/index.js +1 -0
  24. package/docs/docs/aliases.json +59 -0
  25. package/docs/docs/components/base/button/index.md +415 -0
  26. package/docs/docs/components/base/cell/index.md +279 -0
  27. package/docs/docs/components/base/configprovider/index.md +215 -0
  28. package/docs/docs/components/base/image/index.md +282 -0
  29. package/docs/docs/components/base/overlay/index.md +288 -0
  30. package/docs/docs/components/dentry/cascader/index.md +1080 -0
  31. package/docs/docs/components/dentry/checkbox/index.md +842 -0
  32. package/docs/docs/components/dentry/datepicker/index.md +489 -0
  33. package/docs/docs/components/dentry/form/index.md +457 -0
  34. package/docs/docs/components/dentry/input/index.md +257 -0
  35. package/docs/docs/components/dentry/picker/index.md +621 -0
  36. package/docs/docs/components/dentry/radio/index.md +364 -0
  37. package/docs/docs/components/dentry/searchbar/index.md +317 -0
  38. package/docs/docs/components/dentry/selector/index.md +295 -0
  39. package/docs/docs/components/dentry/switch/index.md +300 -0
  40. package/docs/docs/components/dentry/textarea/index.md +231 -0
  41. package/docs/docs/components/dentry/uploader/index.md +745 -0
  42. package/docs/docs/components/exhibition/collapse/index.md +339 -0
  43. package/docs/docs/components/exhibition/swiper/index.md +385 -0
  44. package/docs/docs/components/exhibition/tag/index.md +253 -0
  45. package/docs/docs/components/feedback/dialog/index.md +306 -0
  46. package/docs/docs/components/feedback/drag/index.md +164 -0
  47. package/docs/docs/components/feedback/empty/index.md +211 -0
  48. package/docs/docs/components/feedback/infiniteloading/index.md +397 -0
  49. package/docs/docs/components/feedback/noticebar/index.md +175 -0
  50. package/docs/docs/components/feedback/popup/index.md +563 -0
  51. package/docs/docs/components/feedback/pulltorefresh/index.md +254 -0
  52. package/docs/docs/components/feedback/toast/index.md +355 -0
  53. package/docs/docs/components/layout/divider/index.md +162 -0
  54. package/docs/docs/components/layout/grid/index.md +386 -0
  55. package/docs/docs/components/layout/space/index.md +196 -0
  56. package/docs/docs/components/nav/tabs/index.md +955 -0
  57. package/docs/docs/components-index.json +233 -0
  58. package/package.json +34 -0
@@ -0,0 +1,279 @@
1
+ ---
2
+ order: 2
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/base/pages/cell/index'
4
+ group:
5
+ title: 基础组件
6
+ order: 2
7
+ ---
8
+
9
+ # Cell 单元格 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 列表项,可组成列表。
13
+
14
+ ## 引入
15
+
16
+ ```tsx
17
+ import { Cell } from '@mijadesign/mjui-react-taro'
18
+ ```
19
+
20
+ ## 示例代码
21
+
22
+ ### 自定义右侧区域
23
+
24
+
25
+ ```tsx
26
+ import React from 'react'
27
+ import { Cell, Image, Switch, Tag } from '@mijadesign/mjui-react-taro'
28
+
29
+ const App = () => {
30
+ const title = '文本标签'
31
+ return (
32
+ <Cell.Group>
33
+ <Cell title={title} extra={<div>内容</div>} />
34
+ <Cell title={title} extra={<div>内容超过1行展示效果内容超过1行展示效果内容超过1行展示效果</div>} />
35
+ <Cell
36
+ title={title}
37
+ extra={
38
+ <Image
39
+ style={{ width: '32px', height: '32px', display: 'inline-block' }}
40
+ src="https://sblp-oss.mibaodata.com/static/front-end/family/self_girl.png"
41
+ />
42
+ }
43
+ />
44
+ <Cell
45
+ title={title}
46
+ extra={
47
+ <Tag type="success" mode="fill">
48
+ 标签
49
+ </Tag>
50
+ }
51
+ />
52
+ <Cell title={title} extra={<Switch defaultChecked />} />
53
+ </Cell.Group>
54
+ )
55
+ }
56
+ export default App
57
+
58
+ ```
59
+
60
+ ### 自定义内容
61
+
62
+
63
+ ```tsx
64
+ import React from 'react'
65
+ import { Cell } from '@mijadesign/mjui-react-taro'
66
+
67
+ const Demo2 = () => {
68
+ const title = '文本标签'
69
+ return (
70
+ <Cell.Group>
71
+ <Cell title={title} extra={<div>内容</div>} />
72
+ <Cell>
73
+ <div style={{ marginRight: '16px', color: '#666666' }}>文本标签</div>
74
+ <div>内容</div>
75
+ </Cell>
76
+ </Cell.Group>
77
+ )
78
+ }
79
+ export default Demo2
80
+
81
+ ```
82
+
83
+ ### 分组用法
84
+
85
+ 通过 `divider` 属性可以让单元格之间不显示下边线。
86
+
87
+
88
+ ```tsx
89
+ import React from 'react'
90
+ import { Cell } from '@mijadesign/mjui-react-taro'
91
+
92
+ const Demo7 = () => {
93
+ const title = '文本标签'
94
+ return (
95
+ <Cell.Group divider={false}>
96
+ <Cell title={title} extra="内容" />
97
+ <Cell title={title} extra="内容" />
98
+ </Cell.Group>
99
+ )
100
+ }
101
+ export default Demo7
102
+
103
+ ```
104
+
105
+ ### 基础用法
106
+
107
+
108
+ ```tsx
109
+ import { Cell } from '@mijadesign/mjui-react-taro'
110
+ import React from 'react'
111
+
112
+ const Demo1 = () => {
113
+ const testClick = (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => {
114
+ console.log('点击事件')
115
+ }
116
+ return (
117
+ <>
118
+ <Cell title="我是标题" extra="描述文字" />
119
+ <Cell title="我是标题" description="我是描述" extra="描述文字" />
120
+ <Cell
121
+ title="点击测试"
122
+ onClick={(event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => testClick(event)}
123
+ />
124
+ <Cell title="圆角设置0" radius={0} />
125
+ </>
126
+ )
127
+ }
128
+ export default Demo1
129
+
130
+ ```
131
+
132
+ ### 自定义标题区域
133
+
134
+
135
+ ```tsx
136
+ import { WarningFill } from '@mijadesign/mobile-icons'
137
+ import { Cell } from '@mijadesign/mjui-react-taro'
138
+ import React from 'react'
139
+
140
+ const Demo3 = () => {
141
+ return (
142
+ <Cell
143
+ title={
144
+ <div style={{ display: 'flex', alignItems: 'center' }}>
145
+ <WarningFill />
146
+ <span style={{ marginLeft: '5px' }}>我是标题</span>
147
+ </div>
148
+ }
149
+ description={
150
+ <span>
151
+ 我是描述<b style={{ color: 'red' }}>1</b>
152
+ </span>
153
+ }
154
+ extra="描述文字"
155
+ />
156
+ )
157
+ }
158
+ export default Demo3
159
+
160
+ ```
161
+
162
+ ### 垂直居中
163
+
164
+ 通过 `align` 属性可以让 Cell 的左右内容都垂直居中。
165
+
166
+
167
+ ```tsx
168
+ import { Cell } from '@mijadesign/mjui-react-taro'
169
+ import React from 'react'
170
+
171
+ const Demo5 = () => {
172
+ return <Cell align="center" title="我是标题" description="我是描述" extra="描述文字" />
173
+ }
174
+ export default Demo5
175
+
176
+ ```
177
+
178
+ ### 链接 | 分组用法
179
+
180
+ 使用 `nut-cell-group` 支持 `title`和`extra`
181
+
182
+ ```tsx
183
+ import { Cell } from '@mijadesign/mjui-react-taro'
184
+ import { ArrowRight } from '@nutui/icons-react-taro'
185
+ import { navigateTo, redirectTo } from '@tarojs/taro'
186
+ import React from 'react'
187
+
188
+ const Demo6 = () => {
189
+ const onJumpclick = (event: React.MouseEvent<HTMLDivElement, MouseEvent>, link: string) => {
190
+ const replace = false
191
+ if (link) {
192
+ replace ? redirectTo({ url: link }) : navigateTo({ url: link })
193
+ }
194
+ }
195
+ return (
196
+ <>
197
+ <Cell.Group>
198
+ <Cell className="nutui-cell-clickable" title="链接" align="center" extra={<ArrowRight />} />
199
+ <Cell
200
+ className="nutui-cell-clickable"
201
+ title="URL 跳转"
202
+ extra={
203
+ <>
204
+ <span style={{ marginRight: '5px' }}>链接</span>
205
+ <ArrowRight />
206
+ </>
207
+ }
208
+ align="center"
209
+ onClick={(event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => {
210
+ onJumpclick(event, '/pages/index/index')
211
+ }}
212
+ />
213
+ </Cell.Group>
214
+ </>
215
+ )
216
+ }
217
+ export default Demo6
218
+
219
+ ```
220
+
221
+ ## Cell.Group
222
+
223
+ ### Props
224
+
225
+ | 属性 | 说明 | 类型 | 默认值 |
226
+ | --- | --- | --- | --- |
227
+ | title | 分组标题 | `ReactNode` | `-` |
228
+ | description | 分组描述 | `ReactNode` | `-` |
229
+ | divider | 单元格之间是否有分割线 | `boolean` | `true` |
230
+
231
+ ## Cell
232
+
233
+ ### Props
234
+
235
+ | 属性 | 说明 | 类型 | 默认值 |
236
+ | --- | --- | --- | --- |
237
+ | title | 标题 | `ReactNode` | `-` |
238
+ | description | 描述 | `ReactNode` | `-` |
239
+ | extra | 右侧描述 | `ReactNode` | `-` |
240
+ | radius | 圆角半径 | `string` | `6px` |
241
+ | align | 纵轴方向上的对齐方式,可选值为:`flex-start`、`center`、`flex-end` | `string` | `flex-start` |
242
+ | onClick | 点击事件 | `onClick: (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => void` | `false` |
243
+
244
+ ## 主题定制
245
+
246
+ ### 样式变量
247
+
248
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
249
+
250
+ | 名称 | 说明 | 默认值 |
251
+ | --- | --- | --- |
252
+ | \--nutui-cell-title-color | 单元格标题字体颜色 | `$color-title` |
253
+ | \--nutui-cell-title-font-size | 单元格标题字体大小 | `$font-size-2` |
254
+ | \--nutui-cell-description-color | 单元格描述字体颜色 | `$color-text` |
255
+ | \--nutui-cell-description-font-size | 单元格描述字体大小 | `$font-size-2` |
256
+ | \--nutui-cell-background-color | 单元格背景颜色 | `$color-background-overlay` |
257
+ | \--nutui-cell-border-radius | 单元格圆角大小 | `$radius-1` |
258
+ | \--nutui-cell-box-shadow | 单元格阴影 | `0px 1px 7px 0px rgba(237, 238, 241, 1)` |
259
+ | \--nutui-cell-description-color | 单元格描述字体颜色 | `$color-text` |
260
+ | \--nutui-cell-description-font-size | 单元格描述字体大小 | `$font-size-2` |
261
+ | \--nutui-cell-divider-border-bottom | 单元格分割线下边框 | `0.5px solid $color-border` |
262
+ | \--nutui-cell-divider-left | 单元格分割线左边距 | `$spacing-3` |
263
+ | \--nutui-cell-divider-right | 单元格分割线右边距 | `$spacing-3` |
264
+ | \--nutui-cell-extra-color | 单元格右侧描述字体颜色 | `$color-title` |
265
+ | \--nutui-cell-extra-font-size | 单元格右侧描述字体大小 | `$font-size-2` |
266
+ | \--nutui-cell-group-background-color | 单元格分组的背景颜色 | `$color-background-overlay` |
267
+ | \--nutui-cell-group-description-color | 单元格分组的描述颜色 | `$color-text` |
268
+ | \--nutui-cell-group-description-font-size | 单元格分组的描述字体大小 | `$font-size-1` |
269
+ | \--nutui-cell-group-description-line-height | 单元格分组的描述行高 | `16px` |
270
+ | \--nutui-cell-group-description-padding | 单元格分组的描述内边距 | `0 12px` |
271
+ | \--nutui-cell-group-title-color | 单元格分组的标题字体颜色 | `$color-title` |
272
+ | \--nutui-cell-group-title-font-size | 单元格分组的标题字体大小 | `$font-size-2` |
273
+ | \--nutui-cell-group-title-line-height | 单元格分组的标题行高 | `24px` |
274
+ | \--nutui-cell-group-title-padding | 单元格分组的标题内边距 | `0 12px` |
275
+ | \--nutui-cell-group-wrap-margin | 单元格分组容器的外边距 | `0` |
276
+ | \--nutui-cell-line-height | 单元格行高 | `24px` |
277
+ | \--nutui-cell-padding | 单元格内边距 | `$spacing-3` |
278
+ | \--nutui-cell-title-color | 单元格标题字体颜色 | `$color-title` |
279
+ | \--nutui-cell-title-font-size | 单元格标题字体大小 | `$font-size-2` |
@@ -0,0 +1,215 @@
1
+ ---
2
+ order: 4
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/base/pages/configprovider/index'
4
+ group:
5
+ title: 基础组件
6
+ order: 2
7
+ ---
8
+
9
+ # ConfigProvider 全局配置 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 用于全局配置 mijaui-react 组件,提供主题定制,国际化支持。
13
+
14
+ ## 引入
15
+
16
+ ```tsx
17
+ import { ConfigProvider } from '@mijadesign/mjui-react-taro';
18
+ ```
19
+
20
+ ## 示例代码
21
+
22
+ ### 主题定制
23
+
24
+ mjui-react 可以通过 [CSS 变量](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 来组织样式,通过覆盖这些 CSS 变量,可以实现定制主题、动态切换主题等效果。
25
+
26
+ #### 通过 CSS 覆盖
27
+
28
+ 你可以直接在代码中覆盖这些 CSS 变量,Button 组件的样式会随之发生改变:
29
+
30
+ > 小程序不存在 `:root` 元素,只能在 page 根元素里覆盖 CSS 变量。
31
+
32
+ ```css
33
+ /* 添加这段样式后,Primary Button 会变成绿色 */
34
+ :root {
35
+ --nutui-color-primary: green;
36
+ }
37
+ ```
38
+
39
+ > @mijadesign/mjui-react-taro 中默认主题文件:@mijadesign/mjui-react-taro/dist/styles/custom.scss
40
+
41
+ #### 通过 ConfigProvider 覆盖
42
+
43
+ ConfigProvider 组件提供了覆盖 CSS 变量的能力,你需要在根节点包裹一个 ConfigProvider 组件,并通过 theme 属性来配置一些主题变量。
44
+
45
+ > ConfigProvider 组件不是一个虚拟组件,它会生成一个 View 标签。
46
+
47
+
48
+ ```tsx
49
+ import React from 'react'
50
+ import { ConfigProvider, Cell, Rate, Button } from '@mijadesign/mjui-react-taro'
51
+
52
+ const Demo1 = () => {
53
+ return (
54
+ <>
55
+ <ConfigProvider>
56
+ <Cell.Group>
57
+ <Cell>
58
+ <Rate defaultValue={3} />
59
+ </Cell>
60
+ <Cell>
61
+ <Button type="primary" block>
62
+ 提交
63
+ </Button>
64
+ </Cell>
65
+ </Cell.Group>
66
+ </ConfigProvider>
67
+ </>
68
+ )
69
+ }
70
+
71
+ export default Demo1
72
+
73
+ ```
74
+
75
+
76
+ ```tsx
77
+ import { Button, Cell, ConfigProvider, Rate } from '@mijadesign/mjui-react-taro'
78
+ import React from 'react'
79
+
80
+ const Demo2 = () => {
81
+ const darkTheme = {
82
+ nutuiColorPrimary: 'green',
83
+ }
84
+ return (
85
+ <>
86
+ <ConfigProvider theme={darkTheme}>
87
+ <Cell.Group>
88
+ <Cell>
89
+ <Rate defaultValue={3} />
90
+ </Cell>
91
+ <Cell>
92
+ <Button type="primary" block>
93
+ 提交
94
+ </Button>
95
+ </Cell>
96
+ </Cell.Group>
97
+ </ConfigProvider>
98
+ </>
99
+ )
100
+ }
101
+
102
+ export default Demo2
103
+
104
+ ```
105
+
106
+ #### CSS 变量
107
+
108
+ mjui-react 支持的 CSS 变量如下:
109
+
110
+ ```css
111
+ :root,
112
+ page {
113
+ --nutui-color-primary: red;
114
+ /* 分割线 */
115
+ --nutui-black-1: rgba(0, 0, 0, 0.1),
116
+ /* 边框色 */
117
+ --nutui-black-3: rgba(0, 0, 0, 0.3),
118
+ /* 禁用色 */
119
+ --nutui-black-4: rgba(0, 0, 0, 0.4),
120
+ /* 次要文字色,用于次级标题、属性标示、非主要信息引导等。 */
121
+ --nutui-black-6: rgba(0, 0, 0, 0.6),
122
+ /* 页面全局蒙层,用于弹出层、弹窗、新功能引导出现的整页遮罩 */
123
+ --nutui-black-7: rgba(0, 0, 0, 0.7),
124
+ /* 主要内容用色,常用语常规标题内容、常规按钮文字。 */
125
+ --nutui-black-95: rgba(0, 0, 0, 0.95),
126
+ }
127
+
128
+ ```
129
+
130
+ ### 国际化
131
+
132
+ miui-react 提供了 ConfigProvider 组件用于全局配置国际化文案。目前支持以下语言:
133
+
134
+ * 简体中文 | zh-CN
135
+ * 繁体中文(中国台湾) | zh-TW
136
+ * 维吾尔语 | zh-UG
137
+ * 英语(美式) | en-US
138
+ * 印尼语 | id-ID
139
+
140
+
141
+ ```tsx
142
+ import React from 'react'
143
+ import { ConfigProvider, TextArea } from '@mijadesign/mjui-react-taro'
144
+
145
+ const Demo3 = () => {
146
+ return (
147
+ <>
148
+ <ConfigProvider>
149
+ <TextArea disabled showCount maxLength={20} />
150
+ </ConfigProvider>
151
+ </>
152
+ )
153
+ }
154
+
155
+ export default Demo3
156
+
157
+ ```
158
+
159
+
160
+ ```tsx
161
+ import React from 'react'
162
+ import { ConfigProvider, TextArea } from '@mijadesign/mjui-react-taro'
163
+ import enUS from '@mijadesign/mjui-react-taro/dist/locales/en-US.ts'
164
+
165
+ const Demo4 = () => {
166
+ return (
167
+ <>
168
+ <ConfigProvider locale={enUS}>
169
+ <TextArea disabled showCount maxLength={20} />
170
+ </ConfigProvider>
171
+ </>
172
+ )
173
+ }
174
+
175
+ export default Demo4
176
+
177
+ ```
178
+
179
+ ### RTL
180
+
181
+
182
+ ```tsx
183
+ import React from 'react'
184
+ import { ConfigProvider, Cell } from '@mijadesign/mjui-react-taro'
185
+
186
+ const Demo5 = () => {
187
+ return (
188
+ <>
189
+ <ConfigProvider direction="rtl">
190
+ <Cell
191
+ title={
192
+ <div style={{ display: 'inline-flex', alignItems: 'center' }}>
193
+ <span style={{ marginLeft: '5px' }}>我是标题</span>
194
+ </div>
195
+ }
196
+ description={<span>我是描述</span>}
197
+ extra="描述文字"
198
+ />
199
+ </ConfigProvider>
200
+ </>
201
+ )
202
+ }
203
+
204
+ export default Demo5
205
+
206
+ ```
207
+
208
+ ## ConfigProvider
209
+
210
+ ### Props
211
+
212
+ | 属性 | 说明 | 类型 | 默认值 |
213
+ | --- | --- | --- | --- |
214
+ | locale | 设置多语言包 | `BaseLang` | `zhCN` |
215
+ | theme | 设置主题 | `Record<string, string>` | `-` |