@neovici/cosmoz-input 5.0.4 → 5.0.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/dist/cosmoz-input.js +6 -2
- package/dist/cosmoz-textarea.js +6 -2
- package/dist/render.js +0 -4
- package/dist/styles.js +4 -4
- package/package.json +1 -1
package/dist/cosmoz-input.js
CHANGED
|
@@ -2,12 +2,13 @@ import { html } from 'lit-html';
|
|
|
2
2
|
import { live } from 'lit-html/directives/live.js';
|
|
3
3
|
import { ref } from 'lit-html/directives/ref.js';
|
|
4
4
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
5
|
-
import { component } from '@pionjs/pion';
|
|
5
|
+
import { component, sheet } from '@pionjs/pion';
|
|
6
6
|
import { useImperativeApi } from '@neovici/cosmoz-utils/hooks/use-imperative-api';
|
|
7
7
|
import { useInput } from './use-input';
|
|
8
8
|
import { useAllowedPattern } from './use-allowed-pattern';
|
|
9
9
|
import { render, attributes } from './render';
|
|
10
10
|
import { getPlaceholder } from './util';
|
|
11
|
+
import { styles } from './styles';
|
|
11
12
|
const observedAttributes = [
|
|
12
13
|
'type',
|
|
13
14
|
'pattern',
|
|
@@ -51,4 +52,7 @@ export const Input = (host) => {
|
|
|
51
52
|
/>
|
|
52
53
|
`, host);
|
|
53
54
|
};
|
|
54
|
-
customElements.define('cosmoz-input', component(Input, {
|
|
55
|
+
customElements.define('cosmoz-input', component(Input, {
|
|
56
|
+
observedAttributes,
|
|
57
|
+
styleSheets: [sheet(styles)],
|
|
58
|
+
}));
|
package/dist/cosmoz-textarea.js
CHANGED
|
@@ -2,10 +2,11 @@ import { html } from 'lit-html'; // eslint-disable-line object-curly-newline
|
|
|
2
2
|
import { live } from 'lit-html/directives/live.js';
|
|
3
3
|
import { ref } from 'lit-html/directives/ref.js';
|
|
4
4
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
5
|
-
import { component } from '@pionjs/pion';
|
|
5
|
+
import { component, sheet } from '@pionjs/pion';
|
|
6
6
|
import { useInput } from './use-input';
|
|
7
7
|
import { useAutoHeight } from './use-auto-height';
|
|
8
8
|
import { render, attributes } from './render';
|
|
9
|
+
import { styles } from './styles';
|
|
9
10
|
const observedAttributes = ['rows', ...attributes];
|
|
10
11
|
export const Textarea = (host) => {
|
|
11
12
|
const { autocomplete, value, placeholder, readonly, disabled, rows, cols, maxlength, } = host, { onChange, onFocus, onInput, onRef } = useInput(host);
|
|
@@ -20,4 +21,7 @@ export const Textarea = (host) => {
|
|
|
20
21
|
.value=${live(value ?? '')} maxlength=${ifDefined(maxlength)} @input=${onInput}
|
|
21
22
|
@change=${onChange} @focus=${onFocus} @blur=${onFocus}>`, host);
|
|
22
23
|
};
|
|
23
|
-
customElements.define('cosmoz-textarea', component(Textarea, {
|
|
24
|
+
customElements.define('cosmoz-textarea', component(Textarea, {
|
|
25
|
+
observedAttributes,
|
|
26
|
+
styleSheets: [sheet(styles)],
|
|
27
|
+
}));
|
package/dist/render.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
2
|
import { when } from 'lit-html/directives/when.js';
|
|
3
|
-
import { styles } from './styles';
|
|
4
3
|
export const render = (control, { label, invalid, errorMessage }) => html `
|
|
5
|
-
<style>
|
|
6
|
-
${styles}
|
|
7
|
-
</style>
|
|
8
4
|
<div class="float" part="float"> </div>
|
|
9
5
|
<div class="wrap" part="wrap">
|
|
10
6
|
<slot name="prefix"></slot>
|
package/dist/styles.js
CHANGED
|
@@ -42,8 +42,6 @@ export const styles = css `
|
|
|
42
42
|
display: block;
|
|
43
43
|
padding: var(--cosmoz-input-padding, 8px 0);
|
|
44
44
|
position: relative;
|
|
45
|
-
transition: transform 0.25s, width 0.25s;
|
|
46
|
-
transform-origin: left top;
|
|
47
45
|
max-height: var(--cosmoz-input-max-height);
|
|
48
46
|
font-size: var(--font-size);
|
|
49
47
|
line-height: var(--line-height);
|
|
@@ -100,7 +98,9 @@ export const styles = css `
|
|
|
100
98
|
top: 0;
|
|
101
99
|
left: 0;
|
|
102
100
|
width: var(--cosmoz-input-label-width, 100%);
|
|
103
|
-
transition:
|
|
101
|
+
transition:
|
|
102
|
+
transform 0.25s,
|
|
103
|
+
width 0.25s;
|
|
104
104
|
transform-origin: left top;
|
|
105
105
|
color: var(--color);
|
|
106
106
|
white-space: nowrap;
|
|
@@ -152,7 +152,7 @@ export const styles = css `
|
|
|
152
152
|
left: 0;
|
|
153
153
|
right: 0;
|
|
154
154
|
top: 0;
|
|
155
|
-
transform:
|
|
155
|
+
transform: scaleX(0);
|
|
156
156
|
transform-origin: center center;
|
|
157
157
|
z-index: 1;
|
|
158
158
|
}
|