@atlaskit/range 5.0.11
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 +349 -0
- package/LICENSE +13 -0
- package/README.md +13 -0
- package/__perf__/default.tsx +7 -0
- package/__perf__/range.tsx +42 -0
- package/build/tsconfig.json +17 -0
- package/codemods/4.0.0-lite-mode.ts +92 -0
- package/codemods/__tests__/4.0.0-lite-mode.ts +109 -0
- package/constellation/index/examples.mdx +39 -0
- package/constellation/index/images/range-anatomy.png +0 -0
- package/constellation/index/props.mdx +5 -0
- package/constellation/index/usage.mdx +31 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/range.js +108 -0
- package/dist/cjs/styled.js +94 -0
- package/dist/cjs/theme.js +56 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/range.js +67 -0
- package/dist/es2019/styled.js +255 -0
- package/dist/es2019/theme.js +36 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/range.js +86 -0
- package/dist/esm/styled.js +79 -0
- package/dist/esm/theme.js +38 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/range.d.ts +28 -0
- package/dist/types/styled.d.ts +12 -0
- package/dist/types/theme.d.ts +60 -0
- package/docs/0-intro.tsx +13 -0
- package/extract-react-types/range-props.tsx +5 -0
- package/package.json +80 -0
- package/range/package.json +7 -0
- package/styled/package.json +7 -0
- package/theme/package.json +7 -0
- package/tsconfig.json +19 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# @atlaskit/range
|
|
2
|
+
|
|
3
|
+
## 5.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 5.0.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`378d1cef00f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/378d1cef00f) - Bump `@atlaskit/theme` to version `^11.3.0`.
|
|
14
|
+
|
|
15
|
+
## 5.0.9
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`b0183dd2972`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b0183dd2972) - Updated package.json decriptions and documentation. Docs have moved from atlaskit.atlassian.com to atlassian.design
|
|
20
|
+
|
|
21
|
+
## 5.0.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`d6f7ff383cf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d6f7ff383cf) - Updates to development dependency `storybook-addon-performance`
|
|
26
|
+
|
|
27
|
+
## 5.0.7
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`952019cfd39`](https://bitbucket.org/atlassian/atlassian-frontend/commits/952019cfd39) - Removed extraneous/unnecessary dependencies for design system components.
|
|
32
|
+
|
|
33
|
+
## 5.0.6
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [`3137d05e06`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3137d05e06) - [ux] Fixed rendering bug inside of Range. Now the blue trackbar snaps to a step in the range to align with the position of the thumb.
|
|
38
|
+
|
|
39
|
+
## 5.0.5
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- [`d3265f19be`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d3265f19be) - Transpile packages using babel rather than tsc
|
|
44
|
+
|
|
45
|
+
## 5.0.4
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- [`5f58283e1f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f58283e1f) - Export types using Typescript's new "export type" syntax to satisfy Typescript's --isolatedModules compiler option.
|
|
50
|
+
This requires version 3.8 of Typescript, read more about how we handle Typescript versions here: https://atlaskit.atlassian.com/get-started
|
|
51
|
+
Also add `typescript` to `devDependencies` to denote version that the package was built with.
|
|
52
|
+
|
|
53
|
+
## 5.0.3
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies
|
|
58
|
+
|
|
59
|
+
## 5.0.2
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- [`6c525a8229`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c525a8229) - Upgraded to TypeScript 3.9.6 and tslib to 2.0.0
|
|
64
|
+
|
|
65
|
+
Since tslib is a dependency for all our packages we recommend that products also follow this tslib upgrade
|
|
66
|
+
to prevent duplicates of tslib being bundled.
|
|
67
|
+
|
|
68
|
+
## 5.0.1
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- [`6262f382de`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6262f382de) - Use the 'lodash' package instead of single-function 'lodash.\*' packages
|
|
73
|
+
- [`e99262c6f0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e99262c6f0) - All form elements now have a default font explicitly set
|
|
74
|
+
|
|
75
|
+
## 5.0.0
|
|
76
|
+
|
|
77
|
+
### Major Changes
|
|
78
|
+
|
|
79
|
+
- [`87f4720f27`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87f4720f27) - Officially dropping IE11 support, from this version onwards there are no warranties of the package working in IE11.
|
|
80
|
+
For more information see: https://community.developer.atlassian.com/t/atlaskit-to-drop-support-for-internet-explorer-11-from-1st-july-2020/39534
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies
|
|
85
|
+
|
|
86
|
+
## 4.0.1
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- [`54a9514fcf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/54a9514fcf) - Build and supporting files will no longer be published to npm
|
|
91
|
+
|
|
92
|
+
## 4.0.0
|
|
93
|
+
|
|
94
|
+
### Major Changes
|
|
95
|
+
|
|
96
|
+
- [`da1c8c16d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da1c8c16d4) - In this version we made range dramatically faster and lighter 🤩
|
|
97
|
+
|
|
98
|
+
### Changes
|
|
99
|
+
|
|
100
|
+
In `4.0.0` we bring significant performance improvements all for just the cost of 1 breaking change 😮. That's not all folks because this update comes with a 🤑 FREE 🤑 codemod for you to upgrade with.
|
|
101
|
+
|
|
102
|
+
- Range no longer has a `peerDependency` on `styled-components@3`. Internally range is now using `@emotion/core` for styling
|
|
103
|
+
- A performance issue made the range noticeably laggy with large ranges. With this change we are no longer creating new classes on each step change and instead updating a css variable, making Range noticeably smoother.
|
|
104
|
+
- Changed the `inputRef` prop to be `ref` which returns the `ref` of the range input using `React.forwardRef`. This new `ref` prop will accept the type of the old `inputRef` prop, `(input?: HTMLInputElement) => any`, as well as if `ref` is created with `React.createRef`.
|
|
105
|
+
- A new example that shows off how to rate limit your `onChange` event
|
|
106
|
+
|
|
107
|
+
### Automatic upgrading
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
# You first need to have the latest range installed before you can run the codemod
|
|
111
|
+
yarn upgrade @atlaskit/range@^4.0.0
|
|
112
|
+
|
|
113
|
+
# Run the codemod cli
|
|
114
|
+
# Pass in a parser for your codebase
|
|
115
|
+
npx @atlaskit/codemod-cli /path/to/target/directory --parser [tsx | flow | babel]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Notes
|
|
119
|
+
|
|
120
|
+
- You first need to upgrade to `4.0.0` **before** you run the codemod cli. This is because the cli will look in your local `node_modules` for the codemod which is published inside the `spinner` package.
|
|
121
|
+
- The codemod is pretty clever, and will respect aliasing as well as using custom naming for the default import
|
|
122
|
+
|
|
123
|
+
#### Ez pz lemon squeezy
|
|
124
|
+
|
|
125
|
+
The codemod will change the `inputRef` prop to `ref`
|
|
126
|
+
|
|
127
|
+
```diff
|
|
128
|
+
- <Range inputRef={inputRef} />
|
|
129
|
+
+ <Range ref={inputRef} />
|
|
130
|
+
|
|
131
|
+
- <Range
|
|
132
|
+
- inputRef={ref => {
|
|
133
|
+
- myRangeRef = ref;
|
|
134
|
+
- }}
|
|
135
|
+
- />
|
|
136
|
+
+ <Range
|
|
137
|
+
+ ref={ref => {
|
|
138
|
+
+ myRangeRef = ref;
|
|
139
|
+
+ }}
|
|
140
|
+
+ />
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 3.0.12
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- [patch][6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
149
|
+
|
|
150
|
+
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies [6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
151
|
+
|
|
152
|
+
- @atlaskit/docs@8.3.2
|
|
153
|
+
- @atlaskit/visual-regression@0.1.9
|
|
154
|
+
- @atlaskit/checkbox@10.1.7
|
|
155
|
+
- @atlaskit/theme@9.5.1
|
|
156
|
+
- @atlaskit/tooltip@15.2.3
|
|
157
|
+
|
|
158
|
+
## 3.0.11
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- [patch][4a223473c5](https://bitbucket.org/atlassian/atlassian-frontend/commits/4a223473c5):
|
|
163
|
+
|
|
164
|
+
Removes babel/runtime from dependencies. Users should see a smaller bundlesize as a result- Updated dependencies [82747f2922](https://bitbucket.org/atlassian/atlassian-frontend/commits/82747f2922):
|
|
165
|
+
|
|
166
|
+
- Updated dependencies [4a223473c5](https://bitbucket.org/atlassian/atlassian-frontend/commits/4a223473c5):
|
|
167
|
+
- Updated dependencies [6a8bc6f866](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a8bc6f866):
|
|
168
|
+
- @atlaskit/theme@9.5.0
|
|
169
|
+
- @atlaskit/checkbox@10.1.5
|
|
170
|
+
- @atlaskit/tooltip@15.2.1
|
|
171
|
+
|
|
172
|
+
## 3.0.10
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- [patch][557a8e2451](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/557a8e2451):
|
|
177
|
+
|
|
178
|
+
Rebuilds package to fix typescript typing error.
|
|
179
|
+
|
|
180
|
+
## 3.0.9
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- [patch][35d2229b2a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/35d2229b2a):
|
|
185
|
+
|
|
186
|
+
Adding missing license to packages and update to Copyright 2019 Atlassian Pty Ltd.
|
|
187
|
+
|
|
188
|
+
## 3.0.8
|
|
189
|
+
|
|
190
|
+
- Updated dependencies [97bab7fd28](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/97bab7fd28):
|
|
191
|
+
- @atlaskit/checkbox@10.0.0
|
|
192
|
+
- @atlaskit/docs@8.1.7
|
|
193
|
+
|
|
194
|
+
## 3.0.7
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- [patch][097b696613](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/097b696613):
|
|
199
|
+
|
|
200
|
+
Components now depend on TS 3.6 internally, in order to fix an issue with TS resolving non-relative imports as relative imports
|
|
201
|
+
|
|
202
|
+
## 3.0.6
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- [patch][ecca4d1dbb](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ecca4d1dbb):
|
|
207
|
+
|
|
208
|
+
Upgraded Typescript to 3.3.x
|
|
209
|
+
|
|
210
|
+
## 3.0.5
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- [patch][708028db86](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/708028db86):
|
|
215
|
+
|
|
216
|
+
Change all the imports to theme in Core to use multi entry points
|
|
217
|
+
|
|
218
|
+
## 3.0.4
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- [patch][de35ce8c67](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/de35ce8c67):
|
|
223
|
+
|
|
224
|
+
Updates component maintainers
|
|
225
|
+
|
|
226
|
+
## 3.0.3
|
|
227
|
+
|
|
228
|
+
### Patch Changes
|
|
229
|
+
|
|
230
|
+
- [patch][f34776be97](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f34776be97):
|
|
231
|
+
|
|
232
|
+
Type definition files are now referenced in package.json
|
|
233
|
+
|
|
234
|
+
## 3.0.2
|
|
235
|
+
|
|
236
|
+
- Updated dependencies [87a2638655](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/87a2638655):
|
|
237
|
+
- @atlaskit/checkbox@9.0.0
|
|
238
|
+
|
|
239
|
+
## 3.0.1
|
|
240
|
+
|
|
241
|
+
### Patch Changes
|
|
242
|
+
|
|
243
|
+
- [patch][4615439434](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/4615439434):
|
|
244
|
+
|
|
245
|
+
index.ts will now be ignored when publishing to npm
|
|
246
|
+
|
|
247
|
+
## 3.0.0
|
|
248
|
+
|
|
249
|
+
### Major Changes
|
|
250
|
+
|
|
251
|
+
- [major][4a08d1912e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/4a08d1912e):
|
|
252
|
+
|
|
253
|
+
@atlaskit/range has been converted to Typescript. Typescript consumers will now get static type safety. Flow types are no longer provided. No API or behavioural changes.
|
|
254
|
+
|
|
255
|
+
## 2.0.2
|
|
256
|
+
|
|
257
|
+
- Updated dependencies [67f06f58dd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/67f06f58dd):
|
|
258
|
+
- @atlaskit/tooltip@15.0.0
|
|
259
|
+
|
|
260
|
+
## 2.0.1
|
|
261
|
+
|
|
262
|
+
- Updated dependencies [70862830d6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/70862830d6):
|
|
263
|
+
- @atlaskit/checkbox@8.0.0
|
|
264
|
+
- @atlaskit/theme@9.1.0
|
|
265
|
+
|
|
266
|
+
## 2.0.0
|
|
267
|
+
|
|
268
|
+
- [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
269
|
+
|
|
270
|
+
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use this package, please ensure you use at least this version of react and react-dom.
|
|
271
|
+
|
|
272
|
+
## 1.0.0
|
|
273
|
+
|
|
274
|
+
- [major][546b636a36](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/546b636a36):
|
|
275
|
+
|
|
276
|
+
- This major release indicates that this package is no longer under dev preview but is ready for use
|
|
277
|
+
|
|
278
|
+
## 0.2.2
|
|
279
|
+
|
|
280
|
+
- [patch][1f2a181b0f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/1f2a181b0f):
|
|
281
|
+
|
|
282
|
+
- onChange is no longer overridden by spread props. As a result this component should now work in uncontrolled mode
|
|
283
|
+
|
|
284
|
+
## 0.2.1
|
|
285
|
+
|
|
286
|
+
- Updated dependencies [9c0b4744be](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9c0b4744be):
|
|
287
|
+
- @atlaskit/docs@7.0.3
|
|
288
|
+
- @atlaskit/checkbox@6.0.4
|
|
289
|
+
- @atlaskit/tooltip@13.0.4
|
|
290
|
+
- @atlaskit/theme@8.1.7
|
|
291
|
+
|
|
292
|
+
## 0.2.0
|
|
293
|
+
|
|
294
|
+
- [minor][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
|
|
295
|
+
|
|
296
|
+
- Drop ES5 from all the flow modules
|
|
297
|
+
|
|
298
|
+
### Dropping CJS support in all @atlaskit packages
|
|
299
|
+
|
|
300
|
+
As a breaking change, all @atlaskit packages will be dropping cjs distributions and will only distribute esm. This means all distributed code will be transpiled, but will still contain `import` and
|
|
301
|
+
`export` declarations.
|
|
302
|
+
|
|
303
|
+
The major reason for doing this is to allow us to support multiple entry points in packages, e.g:
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
import colors from `@atlaskit/theme/colors`;
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Previously this was sort of possible for consumers by doing something like:
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
import colors from `@atlaskit/theme/dist/esm/colors`;
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
This has a couple of issues. 1, it treats the file system as API making internal refactors harder, we have to worry about how consumers might be using things that aren't _actually_ supposed to be used. 2. We are unable to do this _internally_ in @atlaskit packages. This leads to lots of packages bundling all of theme, just to use a single color, especially in situations where tree shaking fails.
|
|
316
|
+
|
|
317
|
+
To support being able to use multiple entrypoints internally, we unfortunately cannot have multiple distributions as they would need to have very different imports from of their own internal dependencies.
|
|
318
|
+
|
|
319
|
+
ES Modules are widely supported by all modern bundlers and can be worked around in node environments.
|
|
320
|
+
|
|
321
|
+
We may choose to revisit this solution in the future if we find any unintended condequences, but we see this as a pretty sane path forward which should lead to some major bundle size decreases, saner API's and simpler package architecture.
|
|
322
|
+
|
|
323
|
+
Please reach out to #fabric-build (if in Atlassian) or create an issue in [Design System Support](https://ecosystem.atlassian.net/secure/CreateIssue.jspa?pid=24670) (for external) if you have any questions or queries about this.
|
|
324
|
+
|
|
325
|
+
## 0.1.3
|
|
326
|
+
|
|
327
|
+
- [patch][aab267bb3a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/aab267bb3a):
|
|
328
|
+
|
|
329
|
+
- Added test to make sure the props are passed down to hidden input
|
|
330
|
+
|
|
331
|
+
## 0.1.2
|
|
332
|
+
|
|
333
|
+
- Updated dependencies [58b84fa](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/58b84fa):
|
|
334
|
+
- @atlaskit/checkbox@5.0.9
|
|
335
|
+
- @atlaskit/theme@7.0.1
|
|
336
|
+
- @atlaskit/tooltip@12.1.13
|
|
337
|
+
- @atlaskit/docs@6.0.0
|
|
338
|
+
|
|
339
|
+
## 0.1.1
|
|
340
|
+
|
|
341
|
+
- [patch][d13242d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d13242d):
|
|
342
|
+
|
|
343
|
+
- Change API to experimental theming API to namespace component themes into separate contexts and make theming simpler. Update all dependant components.
|
|
344
|
+
|
|
345
|
+
## 0.1.0
|
|
346
|
+
|
|
347
|
+
- [minor][8945a58](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8945a58):
|
|
348
|
+
|
|
349
|
+
- Initial release
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2019 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Range
|
|
2
|
+
|
|
3
|
+
A range lets users choose an approximate value on a slider.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
yarn add @atlaskit/range
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
For more information, see our [detailed range docs and examples](https://atlassian.design/components/range/).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { fireEvent } from '@testing-library/react';
|
|
4
|
+
import type {
|
|
5
|
+
InteractionTaskArgs,
|
|
6
|
+
PublicInteractionTask,
|
|
7
|
+
} from 'storybook-addon-performance';
|
|
8
|
+
|
|
9
|
+
import Range from '../src';
|
|
10
|
+
|
|
11
|
+
const interactionTasks: PublicInteractionTask[] = [
|
|
12
|
+
{
|
|
13
|
+
name: 'Changing input value',
|
|
14
|
+
description: 'Change the input value of a range with 500 steps',
|
|
15
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
16
|
+
const range: HTMLElement | null = container.querySelector(
|
|
17
|
+
'[data-testid="my-range"]',
|
|
18
|
+
);
|
|
19
|
+
if (range == null) {
|
|
20
|
+
throw new Error('Could not find range element');
|
|
21
|
+
}
|
|
22
|
+
for (let i = 251; i < 300; i++) {
|
|
23
|
+
fireEvent.change(range, { target: { value: i } });
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
function PerformanceComponent() {
|
|
30
|
+
return <Range defaultValue={250} min={0} max={500} testId="my-range" />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
PerformanceComponent.story = {
|
|
34
|
+
name: 'Performance',
|
|
35
|
+
parameters: {
|
|
36
|
+
performance: {
|
|
37
|
+
interactions: interactionTasks,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default PerformanceComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"paths": {}
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"../src/**/*.ts",
|
|
10
|
+
"../src/**/*.tsx"
|
|
11
|
+
],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"../src/**/__tests__/*",
|
|
14
|
+
"../src/**/*.test.*",
|
|
15
|
+
"../src/**/test.*"
|
|
16
|
+
]
|
|
17
|
+
}
|