rsuite 5.60.1 → 5.60.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/DatePicker/styles/index.css +1 -0
- package/DatePicker/styles/index.less +1 -0
- package/DateRangePicker/styles/index.css +2 -0
- package/DateRangePicker/styles/index.less +1 -0
- package/LICENSE +1 -1
- package/README.md +70 -89
- package/RangeSlider/styles/index.css +1 -1
- package/Slider/styles/index.css +1 -1
- package/Slider/styles/index.less +1 -1
- package/Toggle/styles/index.css +6 -1
- package/Toggle/styles/index.less +2 -1
- package/cjs/DateInput/DateField.js +3 -1
- package/cjs/DateInput/DateInput.js +17 -16
- package/cjs/DateInput/{useDateInputState.d.ts → hooks/useDateInputState.d.ts} +1 -1
- package/cjs/DateInput/{useDateInputState.js → hooks/useDateInputState.js} +2 -2
- package/cjs/DateInput/hooks/useFieldCursor.d.ts +6 -0
- package/cjs/DateInput/hooks/useFieldCursor.js +56 -0
- package/cjs/DateInput/hooks/useSelectedState.d.ts +14 -0
- package/cjs/DateInput/hooks/useSelectedState.js +23 -0
- package/cjs/DateInput/index.d.ts +5 -3
- package/cjs/DateInput/index.js +11 -5
- package/cjs/DateInput/utils.d.ts +0 -1
- package/cjs/DateInput/utils.js +2 -24
- package/cjs/DateRangeInput/DateRangeInput.js +16 -17
- package/dist/rsuite-no-reset-rtl.css +9 -2
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +9 -2
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +9 -2
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +9 -2
- package/dist/rsuite.js +46 -24
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/DateInput/DateField.js +3 -1
- package/esm/DateInput/DateInput.js +19 -18
- package/esm/DateInput/{useDateInputState.d.ts → hooks/useDateInputState.d.ts} +1 -1
- package/esm/DateInput/{useDateInputState.js → hooks/useDateInputState.js} +2 -2
- package/esm/DateInput/hooks/useFieldCursor.d.ts +6 -0
- package/esm/DateInput/hooks/useFieldCursor.js +49 -0
- package/esm/DateInput/hooks/useSelectedState.d.ts +14 -0
- package/esm/DateInput/hooks/useSelectedState.js +17 -0
- package/esm/DateInput/index.d.ts +5 -3
- package/esm/DateInput/index.js +5 -3
- package/esm/DateInput/utils.d.ts +0 -1
- package/esm/DateInput/utils.js +2 -23
- package/esm/DateRangeInput/DateRangeInput.js +17 -18
- package/package.json +2 -2
- /package/cjs/DateInput/{useIsFocused.d.ts → hooks/useIsFocused.d.ts} +0 -0
- /package/cjs/DateInput/{useIsFocused.js → hooks/useIsFocused.js} +0 -0
- /package/cjs/DateInput/{useKeyboardInputEvent.d.ts → hooks/useKeyboardInputEvent.d.ts} +0 -0
- /package/cjs/DateInput/{useKeyboardInputEvent.js → hooks/useKeyboardInputEvent.js} +0 -0
- /package/esm/DateInput/{useIsFocused.d.ts → hooks/useIsFocused.d.ts} +0 -0
- /package/esm/DateInput/{useIsFocused.js → hooks/useIsFocused.js} +0 -0
- /package/esm/DateInput/{useKeyboardInputEvent.d.ts → hooks/useKeyboardInputEvent.d.ts} +0 -0
- /package/esm/DateInput/{useKeyboardInputEvent.js → hooks/useKeyboardInputEvent.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [5.60.2](https://github.com/rsuite/rsuite/compare/v5.60.1...v5.60.2) (2024-05-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **date-picker:** cursor pointer on icon hover ([#3789](https://github.com/rsuite/rsuite/issues/3789)) ([fb85faa](https://github.com/rsuite/rsuite/commit/fb85faa01695ab8a48a357e994a451c46c4d7ab3))
|
|
7
|
+
* **DateInput,DateRangeInput:** fix the issue of incorrect cursor position in the input box ([#3785](https://github.com/rsuite/rsuite/issues/3785)) ([d606944](https://github.com/rsuite/rsuite/commit/d6069447aeb156974c7af18050e43ba9443fa4d3))
|
|
8
|
+
* **Slider:** block pointer events when disabled ([#3788](https://github.com/rsuite/rsuite/issues/3788)) ([2470f77](https://github.com/rsuite/rsuite/commit/2470f77225078c2b65536808218286c1c737bee6))
|
|
9
|
+
* **toggle:** center align inner text/icon ([#3787](https://github.com/rsuite/rsuite/issues/3787)) ([c2a8fb1](https://github.com/rsuite/rsuite/commit/c2a8fb13f700dd07b76628a200eb1a5236f21b5c))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
1
13
|
## [5.60.1](https://github.com/rsuite/rsuite/compare/v5.60.0...v5.60.1) (2024-05-03)
|
|
2
14
|
|
|
3
15
|
|
|
@@ -3842,6 +3842,7 @@ textarea.rs-input-group-inside.rs-input-group-xs > .rs-input-group-btn {
|
|
|
3842
3842
|
.rs-picker-date .rs-input-group-addon {
|
|
3843
3843
|
color: #8e8e93;
|
|
3844
3844
|
color: var(--rs-text-secondary);
|
|
3845
|
+
cursor: pointer;
|
|
3845
3846
|
}
|
|
3846
3847
|
.rs-picker-date .rs-input-group-addon .rs-btn-close {
|
|
3847
3848
|
padding: 0;
|
|
@@ -3837,6 +3837,7 @@ textarea.rs-input-group-inside.rs-input-group-xs > .rs-input-group-btn {
|
|
|
3837
3837
|
.rs-picker-date .rs-input-group-addon {
|
|
3838
3838
|
color: #8e8e93;
|
|
3839
3839
|
color: var(--rs-text-secondary);
|
|
3840
|
+
cursor: pointer;
|
|
3840
3841
|
}
|
|
3841
3842
|
.rs-picker-date .rs-input-group-addon .rs-btn-close {
|
|
3842
3843
|
padding: 0;
|
|
@@ -3982,6 +3983,7 @@ textarea.rs-input-group-inside.rs-input-group-xs > .rs-input-group-btn {
|
|
|
3982
3983
|
.rs-picker-daterange .rs-input-group-addon {
|
|
3983
3984
|
color: #8e8e93;
|
|
3984
3985
|
color: var(--rs-text-secondary);
|
|
3986
|
+
cursor: pointer;
|
|
3985
3987
|
}
|
|
3986
3988
|
.rs-picker-daterange .rs-input-group-addon .rs-btn-close {
|
|
3987
3989
|
padding: 0;
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2016-present React Suite Team.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -9,18 +9,13 @@ English | [中文版][readm-cn]
|
|
|
9
9
|
[![npm][npm-svg]][npm-home]
|
|
10
10
|
[![GitHub Actions][actions-svg]][actions-home]
|
|
11
11
|
[![npm bundle size][npm-bundle-size-img]][npm-bundle-size]
|
|
12
|
-
[![rsuite.min.js][rsuite-min-js-img]][rsuite-min-js]
|
|
13
12
|
[![codecov][codecov-img]][codecov]
|
|
14
13
|
[![Discord][discord-svg]][discord-invite]
|
|
15
14
|
[![Gitter][gitter-svg]][gitter]
|
|
16
15
|
[![Gitter][gitter-cn-svg]][gitter-cn]
|
|
17
16
|
[![Gitpod ready-to-code][gitpod-img]][gitpod]
|
|
18
17
|
|
|
19
|
-
React Suite is a set of
|
|
20
|
-
|
|
21
|
-
### UI Design
|
|
22
|
-
|
|
23
|
-
React Suite Design Prototype and specification, click to [view][rsuite-design].
|
|
18
|
+
React Suite is a set of React components. It is committed to providing high-quality and comprehensive React components to help developers quickly build web applications.
|
|
24
19
|
|
|
25
20
|
## Supported Platforms
|
|
26
21
|
|
|
@@ -34,33 +29,28 @@ React Suite supports the latest, stable releases of all major browsers and platf
|
|
|
34
29
|
|
|
35
30
|
### Server
|
|
36
31
|
|
|
37
|
-
React Suite supports server side rendering. Support [Next.js](https://github.com/
|
|
38
|
-
|
|
39
|
-
## Supported development environment
|
|
40
|
-
|
|
41
|
-
- Supports React 16 +
|
|
42
|
-
- Supports [TypeScript](http://www.typescriptlang.org/)
|
|
43
|
-
- Supports [Electron](https://electronjs.org/)
|
|
44
|
-
- Supports [Reason](https://github.com/shurygindv/bs-rsuite-ui-react)
|
|
32
|
+
React Suite supports server side rendering. Support [Next.js](https://github.com/vercel/next.js) to build applications.
|
|
45
33
|
|
|
46
34
|
## Installation
|
|
47
35
|
|
|
48
36
|
React Suite is available as an [npm package][npm-home].
|
|
49
37
|
|
|
50
38
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
or if you prefer Yarn
|
|
39
|
+
# with npm
|
|
40
|
+
npm install rsuite
|
|
55
41
|
|
|
56
|
-
|
|
42
|
+
# with Yarn
|
|
57
43
|
yarn add rsuite
|
|
44
|
+
|
|
45
|
+
# with pnpm
|
|
46
|
+
pnpm add rsuite
|
|
47
|
+
|
|
48
|
+
# with Bun
|
|
49
|
+
bun add rsuite
|
|
58
50
|
```
|
|
59
51
|
|
|
60
52
|
## Usage
|
|
61
53
|
|
|
62
|
-
Here's a simple example
|
|
63
|
-
|
|
64
54
|
```jsx
|
|
65
55
|
import { Button } from 'rsuite';
|
|
66
56
|
import 'rsuite/styles/index.less'; // or 'rsuite/dist/rsuite.min.css'
|
|
@@ -70,54 +60,28 @@ function App() {
|
|
|
70
60
|
}
|
|
71
61
|
```
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Documentation
|
|
76
|
-
|
|
77
|
-
You can go through [full documentation][rsuite-doc-guide] or start with following sections
|
|
78
|
-
|
|
79
|
-
- [Quick start][rsuite-doc-guide]
|
|
80
|
-
- [Less Customization][rsuite-doc-guide-themes]
|
|
81
|
-
- [Internationalization][rsuite-doc-guide-intl]
|
|
82
|
-
- [Right-to-left][rsuite-doc-guide-rtl]
|
|
83
|
-
- [Components][rsuite-components-overview]
|
|
84
|
-
|
|
85
|
-
<details>
|
|
86
|
-
<summary>More examples</summary>
|
|
87
|
-
|
|
88
|
-
- [Management system][demo-admin]
|
|
89
|
-
- [Use modularized][demo-modular-import]
|
|
90
|
-
- [Use CDN][demo-cdn]
|
|
91
|
-
- [Internationalization][demo-intl-app]
|
|
92
|
-
- [Themes][demo-multiple-themes]
|
|
93
|
-
- [RTL - RTLCSS][demo-rtlcss]
|
|
94
|
-
- [RTL - PostCSS-RTL][demo-postcss-rtl]
|
|
95
|
-
- [Use in create-react-app][demo-create-react-app]
|
|
96
|
-
- [Use in Electron][demo-electron]
|
|
97
|
-
- [Use in Flow][demo-flow-app]
|
|
98
|
-
- [Use in TypeScript][demo-typescript-app]
|
|
99
|
-
- [Use in Next.js (App)][demo-nextjs-app]
|
|
100
|
-
- [Use in Next.js (Pages)][demo-nextjs-pages]
|
|
101
|
-
- [Use in UmiJS][demo-umi-app]
|
|
102
|
-
- [Use in Snowpack][demo-snowpack]
|
|
103
|
-
- [Use in Vite][demo-vite]
|
|
104
|
-
</details>
|
|
63
|
+
More guides on how to get started are available [here](https://rsuitejs.com/guide/usage/).
|
|
105
64
|
|
|
106
|
-
|
|
107
|
-
<img src="https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg" alt="Vercel banner" />
|
|
108
|
-
</a>
|
|
65
|
+
## Documentation
|
|
109
66
|
|
|
110
|
-
|
|
67
|
+
It's the https://rsuitejs.com website for the latest version of React Suite. For older versions head over here
|
|
68
|
+
|
|
69
|
+
- [4.x documentation](https://v4.rsuitejs.com/)
|
|
70
|
+
- [3.x documentation](https://v3.rsuitejs.com/)
|
|
111
71
|
|
|
112
72
|
The previous major version 4.x will no longer receive new features,
|
|
113
73
|
and it is recommended to upgrade to the latest 5.x releases.
|
|
114
74
|
Bug fixes for 4.x are still being supported for a period of time,
|
|
115
75
|
and security fixes are supported until 6.x is in progress.
|
|
116
76
|
|
|
117
|
-
|
|
77
|
+
## Framework Guides
|
|
118
78
|
|
|
119
|
-
|
|
120
|
-
|
|
79
|
+
React Suite can be used in your favorite framework. We have prepared step-by-step guides for these frameworks:
|
|
80
|
+
|
|
81
|
+
- [Next.js (App)](https://rsuitejs.com/guide/use-next-app/)
|
|
82
|
+
- [Next.js (Page)](https://rsuitejs.com/guide/use-next-pages)
|
|
83
|
+
- [Create React App](https://rsuitejs.com/guide/use-with-create-react-app/)
|
|
84
|
+
- [Vite](https://rsuitejs.com/guide/use-vite/)
|
|
121
85
|
|
|
122
86
|
## Changelog
|
|
123
87
|
|
|
@@ -127,6 +91,50 @@ Detailed changes for each release are documented in the [release notes][release-
|
|
|
127
91
|
|
|
128
92
|
Make sure you've read the [guidelines][contributing] before you start contributing.
|
|
129
93
|
|
|
94
|
+
## Sponsoring services
|
|
95
|
+
|
|
96
|
+
These great services help us to build and maintain the project.
|
|
97
|
+
|
|
98
|
+
### GitHub
|
|
99
|
+
|
|
100
|
+
Github lets us host the Git repository and coordinate contributions.
|
|
101
|
+
|
|
102
|
+
<a href="https://github.com/" target="_blank">
|
|
103
|
+
<img loading="lazy" alt="CodeCov logo" src="https://avatars.githubusercontent.com/u/9919?s=200&v=4" width="40" height="40">
|
|
104
|
+
</a>
|
|
105
|
+
|
|
106
|
+
### Vercel
|
|
107
|
+
|
|
108
|
+
Vercel provides the hosting for the documentation site.
|
|
109
|
+
|
|
110
|
+
<a href="https://vercel.com?utm_source=rsuite&utm_campaign=oss" target="_blank">
|
|
111
|
+
<img loading="lazy" alt="Vercel logo" src="https://avatars.githubusercontent.com/u/14985020?s=200&v=4" width="40" height="40"/>
|
|
112
|
+
</a>
|
|
113
|
+
|
|
114
|
+
### CodeCov
|
|
115
|
+
|
|
116
|
+
CodeCov lets us monitor test coverage.
|
|
117
|
+
|
|
118
|
+
<a href="https://about.codecov.io/" target="_blank">
|
|
119
|
+
<img loading="lazy" alt="CodeCov logo" src="https://avatars.githubusercontent.com/u/8226205?s=200&v=4" width="40" height="40">
|
|
120
|
+
</a>
|
|
121
|
+
|
|
122
|
+
### CodeSandbox
|
|
123
|
+
|
|
124
|
+
CodeSandbox lets us provide live previews of the components.
|
|
125
|
+
|
|
126
|
+
<a href="https://codesandbox.io/" target="_blank">
|
|
127
|
+
<img loading="lazy" alt="CodeSandbox logo" src="https://avatars.githubusercontent.com/u/32880324?s=200&v=4" width="40" height="40">
|
|
128
|
+
</a>
|
|
129
|
+
|
|
130
|
+
### Stackblitz
|
|
131
|
+
|
|
132
|
+
Stackblitz lets us provide live previews of the components.
|
|
133
|
+
|
|
134
|
+
<a href="https://stackblitz.com/" target="_blank">
|
|
135
|
+
<img loading="lazy" alt="Stackblitz logo" src="https://avatars.githubusercontent.com/u/28635252?s=200&v=4" width="40" height="40">
|
|
136
|
+
</a>
|
|
137
|
+
|
|
130
138
|
## Supporting React Suite
|
|
131
139
|
|
|
132
140
|
If you like React Suite, you can show your support by either
|
|
@@ -138,61 +146,34 @@ If you like React Suite, you can show your support by either
|
|
|
138
146
|
This project exists thanks to all the people who contribute.
|
|
139
147
|
|
|
140
148
|
<a href="https://github.com/rsuite/rsuite/graphs/contributors" target="_blank">
|
|
141
|
-
<img src="https://contrib.rocks/image?repo=rsuite/rsuite" />
|
|
149
|
+
<img src="https://contrib.rocks/image?repo=rsuite/rsuite&max=600" />
|
|
142
150
|
</a>
|
|
143
151
|
|
|
144
152
|
[![opencollective-now][opencollective-svg]][opencollective-home]
|
|
145
153
|
|
|
146
154
|
## License
|
|
147
155
|
|
|
148
|
-
React Suite is [MIT licensed][license].
|
|
156
|
+
React Suite is [MIT licensed][license].
|
|
149
157
|
|
|
150
158
|
[readm-cn]: https://github.com/rsuite/rsuite/blob/main/README_zh.md
|
|
151
159
|
[npm-svg]: https://img.shields.io/npm/v/rsuite
|
|
152
160
|
[npm-home]: https://www.npmjs.com/package/rsuite
|
|
153
161
|
[npm-bundle-size-img]: https://badgen.net/bundlephobia/minzip/rsuite?icon=npm
|
|
154
162
|
[npm-bundle-size]: https://bundlephobia.com/package/rsuite
|
|
155
|
-
[rsuite-min-js-img]: https://img.badgesize.io/https:/unpkg.com/rsuite/dist/rsuite.min.js?label=rsuite.min.js&compression=gzip
|
|
156
|
-
[rsuite-min-js]: https://unpkg.com/browse/rsuite/dist/rsuite.min.js
|
|
157
163
|
[actions-svg]: https://github.com/rsuite/rsuite/workflows/Node.js%20CI/badge.svg?branch=main
|
|
158
164
|
[actions-home]: https://github.com/rsuite/rsuite/actions?query=branch%3Amain+workflow%3A%22Node.js+CI%22
|
|
159
165
|
[discord-svg]: https://img.shields.io/badge/Discord-Join%20chat%20%E2%86%92-738bd7.svg
|
|
160
166
|
[discord-invite]: https://discord.gg/R8mnjwh
|
|
161
|
-
[rsuite-design]: https://rsuitejs.com/design/default
|
|
162
|
-
[live-preview-on-codesandbox]: https://codesandbox.io/s/rsuite-template-5vq6zo2z5l
|
|
163
|
-
[rsuite-doc-guide]: https://rsuitejs.com/en/guide/introduction
|
|
164
|
-
[rsuite-doc-guide-themes]: https://rsuitejs.com/en/guide/customization-less
|
|
165
|
-
[rsuite-doc-guide-intl]: https://rsuitejs.com/en/guide/intl
|
|
166
|
-
[rsuite-doc-guide-rtl]: https://rsuitejs.com/en/guide/rtl
|
|
167
|
-
[rsuite-components-overview]: https://rsuitejs.com/en/components/overview
|
|
168
167
|
[release-notes]: https://github.com/rsuite/rsuite/releases
|
|
169
168
|
[contributing]: https://github.com/rsuite/rsuite/blob/main/CONTRIBUTING.md
|
|
170
|
-
[prettierrc]: https://github.com/rsuite/rsuite/wiki/.prettierrc
|
|
171
169
|
[issues-11]: https://github.com/rsuite/rsuite/issues/11
|
|
172
170
|
[opencollective-svg]: https://opencollective.com/rsuite/tiers/backer.svg?avatarHeight=36
|
|
173
171
|
[opencollective-home]: https://opencollective.com/rsuite
|
|
174
172
|
[license]: https://github.com/rsuite/rsuite/blob/main/LICENSE
|
|
175
|
-
[rsuite-sample]: https://sample.rsuitejs.com/
|
|
176
173
|
[gitter]: https://gitter.im/rsuite/rsuite?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
|
|
177
174
|
[gitter-svg]: https://img.shields.io/gitter/room/rsuite/rsuite?label=chat-english
|
|
178
175
|
[gitter-cn]: https://gitter.im/rsuite/rsuite-CN?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
|
|
179
176
|
[gitter-cn-svg]: https://img.shields.io/gitter/room/rsuite/rsuite?label=chat-chinese
|
|
180
|
-
[demo-admin]: https://github.com/rsuite/rsuite-management-system
|
|
181
|
-
[demo-modular-import]: https://github.com/rsuite/rsuite/tree/main/examples/with-babel-preset-rsuite
|
|
182
|
-
[demo-cdn]: https://github.com/rsuite/rsuite/tree/main/examples/cdn
|
|
183
|
-
[demo-create-react-app]: https://github.com/rsuite/rsuite/tree/main/examples/create-react-app
|
|
184
|
-
[demo-electron]: https://github.com/rsuite/rsuite/tree/main/examples/with-electron
|
|
185
|
-
[demo-intl-app]: https://github.com/rsuite/rsuite/tree/main/examples/custom-i18n
|
|
186
|
-
[demo-multiple-themes]: https://github.com/rsuite/rsuite/tree/main/examples/custom-multiple-themes
|
|
187
|
-
[demo-flow-app]: https://github.com/rsuite/rsuite/tree/main/examples/with-flow
|
|
188
|
-
[demo-typescript-app]: https://github.com/rsuite/rsuite/tree/main/examples/with-typescript
|
|
189
|
-
[demo-nextjs-app]: https://github.com/rsuite/rsuite/tree/main/examples/with-nextjs-app
|
|
190
|
-
[demo-nextjs-pages]: https://github.com/rsuite/rsuite/tree/main/examples/with-nextjs-pages
|
|
191
|
-
[demo-umi-app]: https://github.com/rsuite/rsuite/tree/main/examples/with-umi
|
|
192
|
-
[demo-rtlcss]: https://github.com/rsuite/rsuite/tree/main/examples/with-rtlcss
|
|
193
|
-
[demo-postcss-rtl]: https://github.com/rsuite/rsuite/tree/main/examples/with-postcss-rtl
|
|
194
|
-
[demo-snowpack]: https://github.com/rsuite/rsuite/tree/main/examples/with-snowpack
|
|
195
|
-
[demo-vite]: https://github.com/rsuite/rsuite/tree/main/examples/with-vite
|
|
196
177
|
[codecov]: https://codecov.io/gh/rsuite/rsuite
|
|
197
178
|
[codecov-img]: https://codecov.io/gh/rsuite/rsuite/branch/main/graph/badge.svg?token=HGeKd0BD3t
|
|
198
179
|
[gitpod]: https://gitpod.io/#https://github.com/rsuite/rsuite
|
package/Slider/styles/index.css
CHANGED
package/Slider/styles/index.less
CHANGED
package/Toggle/styles/index.css
CHANGED
|
@@ -264,7 +264,12 @@
|
|
|
264
264
|
display: none;
|
|
265
265
|
}
|
|
266
266
|
.rs-toggle-inner {
|
|
267
|
-
display:
|
|
267
|
+
display: -webkit-box;
|
|
268
|
+
display: -ms-flexbox;
|
|
269
|
+
display: flex;
|
|
270
|
+
-webkit-box-align: center;
|
|
271
|
+
-ms-flex-align: center;
|
|
272
|
+
align-items: center;
|
|
268
273
|
-webkit-transition: margin 0.15s ease-out;
|
|
269
274
|
transition: margin 0.15s ease-out;
|
|
270
275
|
}
|
package/Toggle/styles/index.less
CHANGED
|
@@ -132,7 +132,9 @@ var useDateField = function useDateField(format, localize, date) {
|
|
|
132
132
|
if (typeof value === 'number') {
|
|
133
133
|
value = padNumber(value, pattern.length);
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
if (typeof value !== 'undefined') {
|
|
136
|
+
str = str.replace(pattern, value);
|
|
137
|
+
}
|
|
136
138
|
}
|
|
137
139
|
});
|
|
138
140
|
return str;
|
|
@@ -12,9 +12,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _Input = _interopRequireDefault(require("../Input"));
|
|
13
13
|
var _utils = require("../utils");
|
|
14
14
|
var _utils2 = require("./utils");
|
|
15
|
-
var _useDateInputState2 = _interopRequireDefault(require("./useDateInputState"));
|
|
16
|
-
var _useKeyboardInputEvent = _interopRequireDefault(require("./useKeyboardInputEvent"));
|
|
17
|
-
var _useIsFocused2 = _interopRequireDefault(require("./useIsFocused"));
|
|
15
|
+
var _useDateInputState2 = _interopRequireDefault(require("./hooks/useDateInputState"));
|
|
16
|
+
var _useKeyboardInputEvent = _interopRequireDefault(require("./hooks/useKeyboardInputEvent"));
|
|
17
|
+
var _useIsFocused2 = _interopRequireDefault(require("./hooks/useIsFocused"));
|
|
18
|
+
var _useFieldCursor2 = _interopRequireDefault(require("./hooks/useFieldCursor"));
|
|
19
|
+
var _useSelectedState2 = _interopRequireDefault(require("./hooks/useSelectedState"));
|
|
18
20
|
/**
|
|
19
21
|
* The DateInput component lets users select a date with the keyboard.
|
|
20
22
|
* @version 5.58.0
|
|
@@ -32,13 +34,9 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
32
34
|
onFocus = props.onFocus,
|
|
33
35
|
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["format", "value", "defaultValue", "placeholder", "onChange", "onKeyDown", "onBlur", "onFocus"]);
|
|
34
36
|
var inputRef = (0, _react.useRef)();
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
selectionEnd: 0
|
|
39
|
-
}),
|
|
40
|
-
selectedState = _useState[0],
|
|
41
|
-
setSelectedState = _useState[1];
|
|
37
|
+
var _useSelectedState = (0, _useSelectedState2.default)(),
|
|
38
|
+
selectedState = _useSelectedState.selectedState,
|
|
39
|
+
setSelectedState = _useSelectedState.setSelectedState;
|
|
42
40
|
var _useCustom = (0, _utils.useCustom)('Calendar'),
|
|
43
41
|
locale = _useCustom.locale;
|
|
44
42
|
var dateLocale = locale.dateLocale;
|
|
@@ -58,6 +56,10 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
58
56
|
getDateField = _useDateInputState.getDateField,
|
|
59
57
|
toDateString = _useDateInputState.toDateString,
|
|
60
58
|
isEmptyValue = _useDateInputState.isEmptyValue;
|
|
59
|
+
var _useFieldCursor = (0, _useFieldCursor2.default)(formatStr, valueProp),
|
|
60
|
+
isMoveCursor = _useFieldCursor.isMoveCursor,
|
|
61
|
+
increment = _useFieldCursor.increment,
|
|
62
|
+
reset = _useFieldCursor.reset;
|
|
61
63
|
var dateString = toDateString();
|
|
62
64
|
var keyPressOptions = (0, _react.useMemo)(function () {
|
|
63
65
|
return {
|
|
@@ -80,8 +82,9 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
80
82
|
input: input,
|
|
81
83
|
direction: direction
|
|
82
84
|
}));
|
|
83
|
-
setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
84
85
|
setSelectedState(state);
|
|
86
|
+
setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
87
|
+
reset();
|
|
85
88
|
});
|
|
86
89
|
var onSegmentValueChange = (0, _utils.useEventCallback)(function (event) {
|
|
87
90
|
var input = event.target;
|
|
@@ -104,6 +107,7 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
104
107
|
if (!pattern) {
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
110
|
+
increment();
|
|
107
111
|
var field = getDateField(pattern);
|
|
108
112
|
var value = parseInt(key, 10);
|
|
109
113
|
var padValue = parseInt("" + (field.value || '') + key, 10);
|
|
@@ -113,10 +117,6 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
113
117
|
if ((0, _utils2.validateDateTime)(field.name, padValue)) {
|
|
114
118
|
newValue = padValue;
|
|
115
119
|
}
|
|
116
|
-
if (pattern === 'M') {
|
|
117
|
-
// Month cannot be less than 1.
|
|
118
|
-
newValue = Math.max(1, newValue);
|
|
119
|
-
}
|
|
120
120
|
setDateField(pattern, newValue, function (date) {
|
|
121
121
|
return handleChange(date, event);
|
|
122
122
|
});
|
|
@@ -132,7 +132,7 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
132
132
|
setSelectionRange(nextState.selectionStart, nextState.selectionEnd);
|
|
133
133
|
|
|
134
134
|
// If the field is full value, move the cursor to the next field
|
|
135
|
-
if ((
|
|
135
|
+
if (isMoveCursor(newValue, pattern) && input.selectionEnd !== input.value.length) {
|
|
136
136
|
onSegmentChange(event, 'right');
|
|
137
137
|
}
|
|
138
138
|
});
|
|
@@ -148,6 +148,7 @@ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
148
148
|
setDateField(selectedState.selectedPattern, null, function (date) {
|
|
149
149
|
return handleChange(date, event);
|
|
150
150
|
});
|
|
151
|
+
reset();
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
154
|
var handleClick = (0, _utils.useEventCallback)(function (event) {
|
|
@@ -7,8 +7,8 @@ exports.useDateInputState = useDateInputState;
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _startCase = _interopRequireDefault(require("lodash/startCase"));
|
|
10
|
-
var _dateUtils = require("
|
|
11
|
-
var _DateField = require("
|
|
10
|
+
var _dateUtils = require("../../utils/dateUtils");
|
|
11
|
+
var _DateField = require("../DateField");
|
|
12
12
|
function useDateInputState(_ref) {
|
|
13
13
|
var formatStr = _ref.formatStr,
|
|
14
14
|
locale = _ref.locale,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.useFieldCursor = useFieldCursor;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _useUpdateEffect = _interopRequireDefault(require("../../utils/useUpdateEffect"));
|
|
11
|
+
function useFieldCursor(format, value) {
|
|
12
|
+
var typeCount = (0, _react.useRef)(0);
|
|
13
|
+
var increment = function increment() {
|
|
14
|
+
typeCount.current += 1;
|
|
15
|
+
};
|
|
16
|
+
var reset = function reset() {
|
|
17
|
+
typeCount.current = 0;
|
|
18
|
+
};
|
|
19
|
+
var isMoveCursor = (0, _react.useCallback)(function (value, pattern) {
|
|
20
|
+
var patternGroup = (0, _utils.getPatternGroups)(format, pattern);
|
|
21
|
+
if (value.toString().length === patternGroup.length) {
|
|
22
|
+
return true;
|
|
23
|
+
} else if (pattern === 'y' && typeCount.current === 4) {
|
|
24
|
+
return true;
|
|
25
|
+
} else if (pattern !== 'y' && typeCount.current === 2) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
switch (pattern) {
|
|
29
|
+
case 'M':
|
|
30
|
+
return parseInt(value + "0") > 12;
|
|
31
|
+
case 'd':
|
|
32
|
+
return parseInt(value + "0") > 31;
|
|
33
|
+
case 'H':
|
|
34
|
+
return parseInt(value + "0") > 23;
|
|
35
|
+
case 'h':
|
|
36
|
+
return parseInt(value + "0") > 12;
|
|
37
|
+
case 'm':
|
|
38
|
+
case 's':
|
|
39
|
+
return parseInt(value + "0") > 59;
|
|
40
|
+
default:
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}, [format]);
|
|
44
|
+
(0, _useUpdateEffect.default)(function () {
|
|
45
|
+
if (!value) {
|
|
46
|
+
reset();
|
|
47
|
+
}
|
|
48
|
+
}, [value]);
|
|
49
|
+
return {
|
|
50
|
+
increment: increment,
|
|
51
|
+
reset: reset,
|
|
52
|
+
isMoveCursor: isMoveCursor
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var _default = useFieldCursor;
|
|
56
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useSelectedState(): {
|
|
3
|
+
selectedState: {
|
|
4
|
+
selectedPattern: string;
|
|
5
|
+
selectionStart: number;
|
|
6
|
+
selectionEnd: number;
|
|
7
|
+
};
|
|
8
|
+
setSelectedState: import("react").Dispatch<import("react").SetStateAction<{
|
|
9
|
+
selectedPattern: string;
|
|
10
|
+
selectionStart: number;
|
|
11
|
+
selectionEnd: number;
|
|
12
|
+
}>>;
|
|
13
|
+
};
|
|
14
|
+
export default useSelectedState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.useSelectedState = useSelectedState;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var defaultSelectedState = {
|
|
9
|
+
selectedPattern: 'y',
|
|
10
|
+
selectionStart: 0,
|
|
11
|
+
selectionEnd: 0
|
|
12
|
+
};
|
|
13
|
+
function useSelectedState() {
|
|
14
|
+
var _useState = (0, _react.useState)(defaultSelectedState),
|
|
15
|
+
selectedState = _useState[0],
|
|
16
|
+
setSelectedState = _useState[1];
|
|
17
|
+
return {
|
|
18
|
+
selectedState: selectedState,
|
|
19
|
+
setSelectedState: setSelectedState
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var _default = useSelectedState;
|
|
23
|
+
exports.default = _default;
|
package/cjs/DateInput/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import DateInput from './DateInput';
|
|
2
|
-
export { useDateInputState } from './useDateInputState';
|
|
3
|
-
export { useKeyboardInputEvent } from './useKeyboardInputEvent';
|
|
4
|
-
export { useIsFocused } from './useIsFocused';
|
|
2
|
+
export { useDateInputState } from './hooks/useDateInputState';
|
|
3
|
+
export { useKeyboardInputEvent } from './hooks/useKeyboardInputEvent';
|
|
4
|
+
export { useIsFocused } from './hooks/useIsFocused';
|
|
5
|
+
export { useSelectedState } from './hooks/useSelectedState';
|
|
6
|
+
export { useFieldCursor } from './hooks/useFieldCursor';
|
|
5
7
|
export * from './utils';
|
|
6
8
|
export type { DateInputProps } from './DateInput';
|
|
7
9
|
export default DateInput;
|
package/cjs/DateInput/index.js
CHANGED
|
@@ -6,16 +6,22 @@ exports.__esModule = true;
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
useDateInputState: true,
|
|
8
8
|
useKeyboardInputEvent: true,
|
|
9
|
-
useIsFocused: true
|
|
9
|
+
useIsFocused: true,
|
|
10
|
+
useSelectedState: true,
|
|
11
|
+
useFieldCursor: true
|
|
10
12
|
};
|
|
11
|
-
exports.default = exports.useIsFocused = exports.useKeyboardInputEvent = exports.useDateInputState = void 0;
|
|
13
|
+
exports.default = exports.useFieldCursor = exports.useSelectedState = exports.useIsFocused = exports.useKeyboardInputEvent = exports.useDateInputState = void 0;
|
|
12
14
|
var _DateInput = _interopRequireDefault(require("./DateInput"));
|
|
13
|
-
var _useDateInputState = require("./useDateInputState");
|
|
15
|
+
var _useDateInputState = require("./hooks/useDateInputState");
|
|
14
16
|
exports.useDateInputState = _useDateInputState.useDateInputState;
|
|
15
|
-
var _useKeyboardInputEvent = require("./useKeyboardInputEvent");
|
|
17
|
+
var _useKeyboardInputEvent = require("./hooks/useKeyboardInputEvent");
|
|
16
18
|
exports.useKeyboardInputEvent = _useKeyboardInputEvent.useKeyboardInputEvent;
|
|
17
|
-
var _useIsFocused = require("./useIsFocused");
|
|
19
|
+
var _useIsFocused = require("./hooks/useIsFocused");
|
|
18
20
|
exports.useIsFocused = _useIsFocused.useIsFocused;
|
|
21
|
+
var _useSelectedState = require("./hooks/useSelectedState");
|
|
22
|
+
exports.useSelectedState = _useSelectedState.useSelectedState;
|
|
23
|
+
var _useFieldCursor = require("./hooks/useFieldCursor");
|
|
24
|
+
exports.useFieldCursor = _useFieldCursor.useFieldCursor;
|
|
19
25
|
var _utils = require("./utils");
|
|
20
26
|
Object.keys(_utils).forEach(function (key) {
|
|
21
27
|
if (key === "default" || key === "__esModule") return;
|
package/cjs/DateInput/utils.d.ts
CHANGED
|
@@ -58,6 +58,5 @@ export declare function getInputSelectedState(options: SelectedStateOptions): {
|
|
|
58
58
|
};
|
|
59
59
|
export declare function validateDateTime(type: string, value: number): boolean;
|
|
60
60
|
export declare function modifyDate(date: Date, type: string, value: number): Date;
|
|
61
|
-
export declare function isFieldFullValue(formatStr: string, value: number, pattern: string): boolean;
|
|
62
61
|
export declare function useInputSelection(input: React.RefObject<any>): (selectionStart: number, selectionEnd: number) => void;
|
|
63
62
|
export {};
|