5htp-core 0.2.9-3 → 0.2.9-5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.2.9-3",
4
+ "version": "0.2.9-5",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -19,6 +19,10 @@ h3 {
19
19
  strong {
20
20
  color: var(--cAccent);
21
21
  font-weight: inherit;
22
+
23
+ .bg.img & {
24
+ color: var(--cTxtImportant);
25
+ }
22
26
  }
23
27
  }
24
28
 
@@ -1,6 +1,7 @@
1
1
  @toast-zindex: 999;
2
2
 
3
- #modals, #toasts {
3
+ #modals,
4
+ #toasts {
4
5
 
5
6
  z-index: @toast-zindex;
6
7
 
@@ -60,7 +61,7 @@
60
61
  // Desktop = vertically center the modal
61
62
  @media (min-width: 900px) {
62
63
  justify-content: center;
63
- padding: @spacing;
64
+ //padding: @spacing;
64
65
  }
65
66
 
66
67
  // Pour les animations (ex: conffetis
@@ -79,7 +80,6 @@
79
80
  min-width: 300px;
80
81
  max-height: 100vh;
81
82
  box-shadow: none;
82
- padding: @spacing * 2;
83
83
  overflow-y: auto;
84
84
 
85
85
  // Pas d'anim quand pas card,
@@ -58,7 +58,7 @@ export default ({
58
58
  - INIT
59
59
  ----------------------------------*/
60
60
 
61
- const [{ value, focus, fieldProps }, setValue, commitValue, setState] = useInput(props, '');
61
+ const [{ value, focus, fieldProps }, setValue, commitValue, setState] = useInput(props, '' );
62
62
 
63
63
  // Trigger onchange oly when finished typing
64
64
  const refCommit = React.useRef<NodeJS.Timeout | null>(null);
@@ -71,7 +71,17 @@ export default ({
71
71
 
72
72
  }, [value]);
73
73
 
74
- const updateValue = v => setValue( type === 'number' ? parseFloat(v) : v );
74
+ const updateValue = v => {
75
+ if (type === 'number') {
76
+
77
+ // Fix on Safari: the browser allows to input text in input number
78
+ const numberValue = parseFloat(v);
79
+ if (!Number.isNaN( numberValue ))
80
+ setValue(numberValue);
81
+
82
+ } else
83
+ setValue(v);
84
+ }
75
85
 
76
86
  const refInput = inputRef || React.useRef<HTMLInputElement>();
77
87
 
@@ -154,12 +164,12 @@ export default ({
154
164
  // @ts-ignore: Property 'ref' does not exist on type 'IntrinsicAttributes'
155
165
  ref={refInput}
156
166
  value={value}
157
-
158
167
  onFocus={() => setState({ focus: true })}
159
168
  onBlur={() => setState({ focus: false })}
160
169
  onChange={(e) => updateValue(e.target.value)}
161
170
 
162
- onKeyDown={(e) => {
171
+ onKeyDown={(e: KeyboardEvent) => {
172
+
163
173
  if (onPressEnter && e.key === 'Enter' && value !== undefined) {
164
174
  commitValue();
165
175
  onPressEnter(value)