@popsure/dirty-swan 0.27.27 → 0.27.29
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/dist/index.css +12 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +7 -63
- package/dist/index.js.map +1 -1
- package/dist/lib/scss/utils/_index.scss +12 -0
- package/package.json +2 -3
- package/src/lib/components/input/currency/index.stories.mdx +2 -0
- package/src/lib/components/input/index.tsx +7 -4
- package/src/lib/components/input/style.module.scss +0 -6
- package/src/lib/scss/utils/_index.scss +12 -0
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
@function url-encoded-color($color) {
|
|
2
2
|
@return '%23' + str-slice('#{$color}', 2, -1);
|
|
3
3
|
}
|
|
4
|
+
|
|
5
|
+
.sr-only {
|
|
6
|
+
border-width: 0;
|
|
7
|
+
clip: rect(0, 0, 0, 0);
|
|
8
|
+
height: 1px;
|
|
9
|
+
margin: -1px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
padding: 0;
|
|
12
|
+
position: absolute;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
width: 1px;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popsure/dirty-swan",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.29",
|
|
4
4
|
"author": "Vincent Audoire <vincent@getpopsure.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"react-scroll-sync": "^0.9.0",
|
|
35
35
|
"remark-directive": "^2.0.1",
|
|
36
36
|
"sass": "^1.35.1",
|
|
37
|
-
"signature_pad": "^3.0.0-beta.3"
|
|
38
|
-
"uuid": "^9.0.0"
|
|
37
|
+
"signature_pad": "^3.0.0-beta.3"
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
41
40
|
"react": "^16.12.0",
|
|
@@ -27,5 +27,7 @@ The following will be done:
|
|
|
27
27
|
<CurrencyInput className="wmx5 mt8" label="Amount" placeholder="100" />
|
|
28
28
|
<h4 className="p-h4 mt24">With label and no placeholder</h4>
|
|
29
29
|
<CurrencyInput className="wmx5 mt8" label="Amount" />
|
|
30
|
+
<h4 className="p-h4 mt24">With placeholder and no label</h4>
|
|
31
|
+
<CurrencyInput className="wmx5 mt8" hideLabel label="Amount" placeholder="0" />
|
|
30
32
|
</>
|
|
31
33
|
</Preview>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
4
3
|
|
|
5
4
|
import styles from './style.module.scss';
|
|
6
5
|
|
|
6
|
+
const generateUniqueId = () => {
|
|
7
|
+
return `input-id-${Math.floor(Math.random() * 10000000)}`;
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
// Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.
|
|
8
11
|
export type InputProps = {
|
|
9
12
|
error?: string;
|
|
@@ -29,7 +32,7 @@ export default React.forwardRef(
|
|
|
29
32
|
}: InputProps,
|
|
30
33
|
ref?: React.ForwardedRef<HTMLInputElement>
|
|
31
34
|
) => {
|
|
32
|
-
const uniqueId = id ??
|
|
35
|
+
const [uniqueId] = useState(id ?? generateUniqueId());
|
|
33
36
|
return (
|
|
34
37
|
<div className={`${styles.container} ${className ?? ''}`}>
|
|
35
38
|
{label && (
|
|
@@ -37,7 +40,7 @@ export default React.forwardRef(
|
|
|
37
40
|
htmlFor={uniqueId}
|
|
38
41
|
className={classnames('p-p', styles.label, {
|
|
39
42
|
[styles['label--with-error']]: error,
|
|
40
|
-
|
|
43
|
+
"sr-only": hideLabel,
|
|
41
44
|
})}
|
|
42
45
|
>
|
|
43
46
|
{label}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
@function url-encoded-color($color) {
|
|
2
2
|
@return '%23' + str-slice('#{$color}', 2, -1);
|
|
3
3
|
}
|
|
4
|
+
|
|
5
|
+
.sr-only {
|
|
6
|
+
border-width: 0;
|
|
7
|
+
clip: rect(0, 0, 0, 0);
|
|
8
|
+
height: 1px;
|
|
9
|
+
margin: -1px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
padding: 0;
|
|
12
|
+
position: absolute;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
width: 1px;
|
|
15
|
+
}
|