@neovici/cosmoz-input 3.8.0 → 3.9.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.
- package/dist/cosmoz-input.js +3 -2
- package/dist/styles.js +5 -3
- package/dist/util.d.ts +7 -0
- package/dist/util.js +3 -0
- package/package.json +1 -1
package/dist/cosmoz-input.js
CHANGED
|
@@ -5,6 +5,7 @@ import { component } from 'haunted';
|
|
|
5
5
|
import { useInput } from './use-input';
|
|
6
6
|
import { useAllowedPattern } from './use-allowed-pattern';
|
|
7
7
|
import { render, attributes } from './render';
|
|
8
|
+
import { getPlaceholder } from './util';
|
|
8
9
|
const observedAttributes = [
|
|
9
10
|
'type',
|
|
10
11
|
'pattern',
|
|
@@ -16,7 +17,7 @@ const observedAttributes = [
|
|
|
16
17
|
...attributes,
|
|
17
18
|
];
|
|
18
19
|
export const Input = (host) => {
|
|
19
|
-
const { type = 'text', pattern, allowedPattern, autocomplete, value,
|
|
20
|
+
const { type = 'text', pattern, allowedPattern, autocomplete, value, readonly, disabled, min, max, step, maxlength, } = host, { onChange, onFocus, onInput } = useInput(host);
|
|
20
21
|
const onBeforeInput = useAllowedPattern(allowedPattern);
|
|
21
22
|
return render(html `
|
|
22
23
|
<input
|
|
@@ -26,7 +27,7 @@ export const Input = (host) => {
|
|
|
26
27
|
type=${type}
|
|
27
28
|
pattern=${ifDefined(pattern)}
|
|
28
29
|
autocomplete=${ifDefined(autocomplete)}
|
|
29
|
-
placeholder=${
|
|
30
|
+
placeholder=${getPlaceholder(host)}
|
|
30
31
|
?readonly=${readonly}
|
|
31
32
|
?aria-disabled=${disabled}
|
|
32
33
|
?disabled=${disabled}
|
package/dist/styles.js
CHANGED
|
@@ -102,8 +102,10 @@ export const styles = css `
|
|
|
102
102
|
transform: translateY(calc(var(--label-scale) * -100%))
|
|
103
103
|
scale(var(--label-scale));
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
:host(:not(always-float-label):focus-within) #input::placeholder,
|
|
106
|
+
:host(:focus-within) label {
|
|
106
107
|
color: var(--focused-color);
|
|
108
|
+
opacity: 1;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
.line {
|
|
@@ -137,7 +139,7 @@ export const styles = css `
|
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
:host([no-label-float]) .float,
|
|
140
|
-
:host([no-label-float])
|
|
142
|
+
:host([no-label-float]) label {
|
|
141
143
|
display: none;
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -190,7 +192,7 @@ export const styles = css `
|
|
|
190
192
|
width: var(--width);
|
|
191
193
|
min-width: calc(2ch + 0.25em);
|
|
192
194
|
}
|
|
193
|
-
:host([type=
|
|
195
|
+
:host([type='color']) .line {
|
|
194
196
|
display: none;
|
|
195
197
|
}
|
|
196
198
|
`;
|
package/dist/util.d.ts
ADDED
package/dist/util.js
ADDED