@digital-realty/ix-textbox 2.0.1 → 2.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/LICENSE +20 -20
- package/README.md +68 -62
- package/dist/src/IxTextbox.d.ts +111 -105
- package/dist/src/IxTextbox.js +250 -239
- package/dist/src/IxTextbox.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/ix-textbox-styles.d.ts +1 -1
- package/dist/src/ix-textbox-styles.js +58 -58
- package/dist/src/ix-textbox-styles.js.map +1 -1
- package/dist/src/ix-textbox.d.ts +1 -1
- package/dist/src/ix-textbox.js +2 -2
- package/dist/src/ix-textbox.js.map +1 -1
- package/dist/src/react/IxTextbox.d.ts +2 -0
- package/dist/src/react/IxTextbox.js +10 -0
- package/dist/src/react/IxTextbox.js.map +1 -0
- package/dist/src/types/index.d.ts +14 -8
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/test/ix-textbox.test.d.ts +1 -1
- package/dist/test/ix-textbox.test.js +22 -22
- package/dist/test/ix-textbox.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +94 -91
- package/src/IxTextbox.ts +216 -194
- package/src/index.ts +1 -1
- package/src/ix-textbox-styles.ts +59 -59
- package/src/ix-textbox.ts +3 -3
- package/src/react/IxTextbox.ts +11 -0
- package/src/types/index.ts +29 -24
- package/test/ix-textbox.test.ts +32 -32
- package/tsconfig.json +22 -22
- package/web-dev-server.config.mjs +27 -27
- package/web-test-runner.config.mjs +41 -41
- package/.editorconfig +0 -29
- package/demo/index.html +0 -29
- package/dist/stories/index.stories.d.ts +0 -33
- package/dist/stories/index.stories.js +0 -37
- package/dist/stories/index.stories.js.map +0 -1
package/src/ix-textbox-styles.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const IxTextboxStyles = css`
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
:host([hidden]) {
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
input {
|
|
13
|
-
display: block;
|
|
14
|
-
width: 100%;
|
|
15
|
-
padding: 0.5em;
|
|
16
|
-
font-size: 1rem;
|
|
17
|
-
line-height: 1.25rem;
|
|
18
|
-
border: 1px solid lightgrey;
|
|
19
|
-
background-repeat: no-repeat;
|
|
20
|
-
background-position: calc(100% - 0.5em) 50%;
|
|
21
|
-
border-radius: 3px;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
input:focus {
|
|
26
|
-
outline: none;
|
|
27
|
-
box-shadow: 0 0 2px 1px rgba(0, 153, 204, 0.39),
|
|
28
|
-
0 0 4px 3px rgba(0, 153, 204, 0.18), 0 0 8px 4px rgba(0, 153, 204, 0.1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
input:required.-is-valid {
|
|
32
|
-
border-color: #99ca3c;
|
|
33
|
-
background-image: url("data:image/svg+xml,%3Csvg width='19px' height='13px' viewBox='0 0 19 13' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cpolygon fill='%2399CA3C' points='6.70967742 13 0 6.29032258 2.09677419 4.19354839 6.70967742 8.80645161 16.3548387 0 18.4516129 2.09677419'%3E%3C/polygon%3E %3C/svg%3E");
|
|
34
|
-
padding-right: 2em;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
input:required.-is-invalid {
|
|
38
|
-
border-color: #e3097c;
|
|
39
|
-
background-image: url("data:image/svg+xml,%3Csvg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cpolygon id='Path' fill='%23E3097C' points='12.759145 0.0312229203 14.8804653 2.15254326 9.57716447 7.45584412 14.8804653 12.759145 12.759145 14.8804653 7.45584412 9.57716447 2.15254326 14.8804653 0.0312229203 12.759145 5.33452378 7.45584412 0.0312229203 2.15254326 2.15254326 0.0312229203 7.45584412 5.33452378'%3E%3C/polygon%3E %3C/svg%3E");
|
|
40
|
-
padding-right: 2em;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
input[type='search'] {
|
|
44
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CclipPath id='clip-path'%3E%3Cpath id='Path_46' data-name='Path 46' d='M17.835-27.347l5.506,5.506a2.249,2.249,0,0,1,0,3.182,2.249,2.249,0,0,1-3.182,0h0l-5.506-5.506a10.6,10.6,0,0,0,3.182-3.182ZM9-42a9,9,0,0,1,9,9,9,9,0,0,1-9,9,9,9,0,0,1-9-9A9,9,0,0,1,9-42Zm0,2.25A6.757,6.757,0,0,0,2.25-33,6.757,6.757,0,0,0,9-26.25,6.757,6.757,0,0,0,15.75-33,6.758,6.758,0,0,0,9-39.75Zm0,1.5v1.5A3.754,3.754,0,0,0,5.25-33H3.75A5.256,5.256,0,0,1,9-38.25Z' transform='translate(0 42)' fill='%23d8d8d8' clip-rule='evenodd'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg id='icon_search' data-name='icon search' clip-path='url(%23clip-path)'%3E%3Cpath id='Path_45' data-name='Path 45' d='M-1-43H24.363v25.363H-1Z' transform='translate(0.429 42.429)' fill='%23d8d8d8'/%3E%3C/g%3E%3C/svg%3E%0A");
|
|
45
|
-
background-position: 0.5em 50%;
|
|
46
|
-
padding-left: 2.25rem;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
input:disabled {
|
|
50
|
-
border-width: 0 0 1px;
|
|
51
|
-
color: #595959;
|
|
52
|
-
border-color: lightgrey;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
input:not([type='search']):disabled {
|
|
56
|
-
background-image: none;
|
|
57
|
-
padding-left: 0;
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const IxTextboxStyles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:host([hidden]) {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
input {
|
|
13
|
+
display: block;
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding: 0.5em;
|
|
16
|
+
font-size: 1rem;
|
|
17
|
+
line-height: 1.25rem;
|
|
18
|
+
border: 1px solid lightgrey;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
background-position: calc(100% - 0.5em) 50%;
|
|
21
|
+
border-radius: 3px;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
input:focus {
|
|
26
|
+
outline: none;
|
|
27
|
+
box-shadow: 0 0 2px 1px rgba(0, 153, 204, 0.39),
|
|
28
|
+
0 0 4px 3px rgba(0, 153, 204, 0.18), 0 0 8px 4px rgba(0, 153, 204, 0.1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
input:required.-is-valid {
|
|
32
|
+
border-color: #99ca3c;
|
|
33
|
+
background-image: url("data:image/svg+xml,%3Csvg width='19px' height='13px' viewBox='0 0 19 13' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cpolygon fill='%2399CA3C' points='6.70967742 13 0 6.29032258 2.09677419 4.19354839 6.70967742 8.80645161 16.3548387 0 18.4516129 2.09677419'%3E%3C/polygon%3E %3C/svg%3E");
|
|
34
|
+
padding-right: 2em;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
input:required.-is-invalid {
|
|
38
|
+
border-color: #e3097c;
|
|
39
|
+
background-image: url("data:image/svg+xml,%3Csvg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cpolygon id='Path' fill='%23E3097C' points='12.759145 0.0312229203 14.8804653 2.15254326 9.57716447 7.45584412 14.8804653 12.759145 12.759145 14.8804653 7.45584412 9.57716447 2.15254326 14.8804653 0.0312229203 12.759145 5.33452378 7.45584412 0.0312229203 2.15254326 2.15254326 0.0312229203 7.45584412 5.33452378'%3E%3C/polygon%3E %3C/svg%3E");
|
|
40
|
+
padding-right: 2em;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input[type='search'] {
|
|
44
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CclipPath id='clip-path'%3E%3Cpath id='Path_46' data-name='Path 46' d='M17.835-27.347l5.506,5.506a2.249,2.249,0,0,1,0,3.182,2.249,2.249,0,0,1-3.182,0h0l-5.506-5.506a10.6,10.6,0,0,0,3.182-3.182ZM9-42a9,9,0,0,1,9,9,9,9,0,0,1-9,9,9,9,0,0,1-9-9A9,9,0,0,1,9-42Zm0,2.25A6.757,6.757,0,0,0,2.25-33,6.757,6.757,0,0,0,9-26.25,6.757,6.757,0,0,0,15.75-33,6.758,6.758,0,0,0,9-39.75Zm0,1.5v1.5A3.754,3.754,0,0,0,5.25-33H3.75A5.256,5.256,0,0,1,9-38.25Z' transform='translate(0 42)' fill='%23d8d8d8' clip-rule='evenodd'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg id='icon_search' data-name='icon search' clip-path='url(%23clip-path)'%3E%3Cpath id='Path_45' data-name='Path 45' d='M-1-43H24.363v25.363H-1Z' transform='translate(0.429 42.429)' fill='%23d8d8d8'/%3E%3C/g%3E%3C/svg%3E%0A");
|
|
45
|
+
background-position: 0.5em 50%;
|
|
46
|
+
padding-left: 2.25rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
input:disabled {
|
|
50
|
+
border-width: 0 0 1px;
|
|
51
|
+
color: #595959;
|
|
52
|
+
border-color: lightgrey;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
input:not([type='search']):disabled {
|
|
56
|
+
background-image: none;
|
|
57
|
+
padding-left: 0;
|
|
58
|
+
}
|
|
59
|
+
`;
|
package/src/ix-textbox.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IxTextbox } from './IxTextbox.js';
|
|
2
|
-
|
|
3
|
-
window.customElements.define('ix-textbox', IxTextbox);
|
|
1
|
+
import { IxTextbox } from './IxTextbox.js';
|
|
2
|
+
|
|
3
|
+
window.customElements.define('ix-textbox', IxTextbox);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit-labs/react';
|
|
3
|
+
import { IxTextbox as LitComp } from '../IxTextbox.js';
|
|
4
|
+
|
|
5
|
+
window.customElements.define('ix-textbox', LitComp);
|
|
6
|
+
|
|
7
|
+
export const IxTextbox = createComponent({
|
|
8
|
+
tagName: 'ix-textbox',
|
|
9
|
+
elementClass: LitComp,
|
|
10
|
+
react: React,
|
|
11
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Input types that are compatible with the text field.
|
|
3
|
-
*/
|
|
4
|
-
export type TextFieldType =
|
|
5
|
-
| 'email'
|
|
6
|
-
| 'number'
|
|
7
|
-
| 'password'
|
|
8
|
-
| 'search'
|
|
9
|
-
| 'tel'
|
|
10
|
-
| 'text'
|
|
11
|
-
| 'url'
|
|
12
|
-
| 'textarea';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Input types that are not fully supported for the text field.
|
|
16
|
-
*/
|
|
17
|
-
export type UnsupportedTextFieldType =
|
|
18
|
-
| 'color'
|
|
19
|
-
| 'date'
|
|
20
|
-
| 'datetime-local'
|
|
21
|
-
| 'file'
|
|
22
|
-
| 'month'
|
|
23
|
-
| 'time'
|
|
24
|
-
| 'week';
|
|
1
|
+
/**
|
|
2
|
+
* Input types that are compatible with the text field.
|
|
3
|
+
*/
|
|
4
|
+
export type TextFieldType =
|
|
5
|
+
| 'email'
|
|
6
|
+
| 'number'
|
|
7
|
+
| 'password'
|
|
8
|
+
| 'search'
|
|
9
|
+
| 'tel'
|
|
10
|
+
| 'text'
|
|
11
|
+
| 'url'
|
|
12
|
+
| 'textarea';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Input types that are not fully supported for the text field.
|
|
16
|
+
*/
|
|
17
|
+
export type UnsupportedTextFieldType =
|
|
18
|
+
| 'color'
|
|
19
|
+
| 'date'
|
|
20
|
+
| 'datetime-local'
|
|
21
|
+
| 'file'
|
|
22
|
+
| 'month'
|
|
23
|
+
| 'time'
|
|
24
|
+
| 'week';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The event that is fired when the text field's value changes.
|
|
28
|
+
*/
|
|
29
|
+
export type TextChangeEvent = CustomEvent<{ value: string }>;
|
package/test/ix-textbox.test.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { fixture, expect } from '@open-wc/testing';
|
|
3
|
-
import { IxTextbox } from '../src/IxTextbox.js';
|
|
4
|
-
import '../src/ix-textbox.js';
|
|
5
|
-
|
|
6
|
-
describe('IxTextbox', () => {
|
|
7
|
-
it('should show the outlined text field by default', async () => {
|
|
8
|
-
const el = await fixture<IxTextbox>(html`<ix-textbox></ix-textbox>`);
|
|
9
|
-
console.log(el.innerHTML);
|
|
10
|
-
const outlinedTextField = el.shadowRoot?.querySelector(
|
|
11
|
-
'md-outlined-text-field'
|
|
12
|
-
);
|
|
13
|
-
const filledTextField = el.shadowRoot?.querySelector(
|
|
14
|
-
'md-filled-text-field'
|
|
15
|
-
);
|
|
16
|
-
expect(outlinedTextField).to.not.be.null;
|
|
17
|
-
expect(filledTextField).to.be.null;
|
|
18
|
-
});
|
|
19
|
-
it('should show the filled text field when outlined is false', async () => {
|
|
20
|
-
const el = await fixture<IxTextbox>(
|
|
21
|
-
html`<ix-textbox .outlined=${false}></ix-textbox>`
|
|
22
|
-
);
|
|
23
|
-
const outlinedTextField = el.shadowRoot?.querySelector(
|
|
24
|
-
'md-outlined-text-field'
|
|
25
|
-
);
|
|
26
|
-
const filledTextField = el.shadowRoot?.querySelector(
|
|
27
|
-
'md-filled-text-field'
|
|
28
|
-
);
|
|
29
|
-
expect(outlinedTextField).to.be.null;
|
|
30
|
-
expect(filledTextField).to.not.be.null;
|
|
31
|
-
});
|
|
32
|
-
});
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { fixture, expect } from '@open-wc/testing';
|
|
3
|
+
import { IxTextbox } from '../src/IxTextbox.js';
|
|
4
|
+
import '../src/ix-textbox.js';
|
|
5
|
+
|
|
6
|
+
describe('IxTextbox', () => {
|
|
7
|
+
it('should show the outlined text field by default', async () => {
|
|
8
|
+
const el = await fixture<IxTextbox>(html`<ix-textbox></ix-textbox>`);
|
|
9
|
+
console.log(el.innerHTML);
|
|
10
|
+
const outlinedTextField = el.shadowRoot?.querySelector(
|
|
11
|
+
'md-outlined-text-field'
|
|
12
|
+
);
|
|
13
|
+
const filledTextField = el.shadowRoot?.querySelector(
|
|
14
|
+
'md-filled-text-field'
|
|
15
|
+
);
|
|
16
|
+
expect(outlinedTextField).to.not.be.null;
|
|
17
|
+
expect(filledTextField).to.be.null;
|
|
18
|
+
});
|
|
19
|
+
it('should show the filled text field when outlined is false', async () => {
|
|
20
|
+
const el = await fixture<IxTextbox>(
|
|
21
|
+
html`<ix-textbox .outlined=${false}></ix-textbox>`
|
|
22
|
+
);
|
|
23
|
+
const outlinedTextField = el.shadowRoot?.querySelector(
|
|
24
|
+
'md-outlined-text-field'
|
|
25
|
+
);
|
|
26
|
+
const filledTextField = el.shadowRoot?.querySelector(
|
|
27
|
+
'md-filled-text-field'
|
|
28
|
+
);
|
|
29
|
+
expect(outlinedTextField).to.be.null;
|
|
30
|
+
expect(filledTextField).to.not.be.null;
|
|
31
|
+
});
|
|
32
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2017", "dom"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"importHelpers": true,
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"inlineSources": true,
|
|
16
|
-
"rootDir": "./",
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"incremental": true,
|
|
19
|
-
"noImplicitAny": false
|
|
20
|
-
},
|
|
21
|
-
"include": ["**/*.ts"]
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2018",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": ["es2017", "dom"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"inlineSources": true,
|
|
16
|
+
"rootDir": "./",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"noImplicitAny": false
|
|
20
|
+
},
|
|
21
|
+
"include": ["**/*.ts"]
|
|
22
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
open: '/demo/',
|
|
8
|
-
/** Use regular watch mode if HMR is not enabled. */
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
/** Resolve bare module imports */
|
|
11
|
-
nodeResolve: {
|
|
12
|
-
exportConditions: ['browser', 'development'],
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
16
|
-
// esbuildTarget: 'auto'
|
|
17
|
-
|
|
18
|
-
/** Set appIndex to enable SPA routing */
|
|
19
|
-
// appIndex: 'demo/index.html',
|
|
20
|
-
|
|
21
|
-
plugins: [
|
|
22
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
23
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
// See documentation for all available options
|
|
27
|
-
});
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
|
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
|
5
|
+
|
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
+
open: '/demo/',
|
|
8
|
+
/** Use regular watch mode if HMR is not enabled. */
|
|
9
|
+
watch: !hmr,
|
|
10
|
+
/** Resolve bare module imports */
|
|
11
|
+
nodeResolve: {
|
|
12
|
+
exportConditions: ['browser', 'development'],
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
16
|
+
// esbuildTarget: 'auto'
|
|
17
|
+
|
|
18
|
+
/** Set appIndex to enable SPA routing */
|
|
19
|
+
// appIndex: 'demo/index.html',
|
|
20
|
+
|
|
21
|
+
plugins: [
|
|
22
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
23
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
// See documentation for all available options
|
|
27
|
+
});
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
|
-
|
|
3
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
4
|
-
|
|
5
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
6
|
-
/** Test files to run */
|
|
7
|
-
files: 'dist/test/**/*.test.js',
|
|
8
|
-
|
|
9
|
-
/** Resolve bare module imports */
|
|
10
|
-
nodeResolve: {
|
|
11
|
-
exportConditions: ['browser', 'development'],
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/** Filter out lit dev mode logs */
|
|
15
|
-
filterBrowserLogs(log) {
|
|
16
|
-
for (const arg of log.args) {
|
|
17
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
25
|
-
// esbuildTarget: 'auto',
|
|
26
|
-
|
|
27
|
-
/** Amount of browsers to run concurrently */
|
|
28
|
-
// concurrentBrowsers: 2,
|
|
29
|
-
|
|
30
|
-
/** Amount of test files per browser to test concurrently */
|
|
31
|
-
// concurrency: 1,
|
|
32
|
-
|
|
33
|
-
/** Browsers to run tests on */
|
|
34
|
-
// browsers: [
|
|
35
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
36
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
37
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
38
|
-
// ],
|
|
39
|
-
|
|
40
|
-
// See documentation for all available options
|
|
41
|
-
});
|
|
1
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
|
+
|
|
3
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
4
|
+
|
|
5
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
6
|
+
/** Test files to run */
|
|
7
|
+
files: 'dist/test/**/*.test.js',
|
|
8
|
+
|
|
9
|
+
/** Resolve bare module imports */
|
|
10
|
+
nodeResolve: {
|
|
11
|
+
exportConditions: ['browser', 'development'],
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/** Filter out lit dev mode logs */
|
|
15
|
+
filterBrowserLogs(log) {
|
|
16
|
+
for (const arg of log.args) {
|
|
17
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
25
|
+
// esbuildTarget: 'auto',
|
|
26
|
+
|
|
27
|
+
/** Amount of browsers to run concurrently */
|
|
28
|
+
// concurrentBrowsers: 2,
|
|
29
|
+
|
|
30
|
+
/** Amount of test files per browser to test concurrently */
|
|
31
|
+
// concurrency: 1,
|
|
32
|
+
|
|
33
|
+
/** Browsers to run tests on */
|
|
34
|
+
// browsers: [
|
|
35
|
+
// playwrightLauncher({ product: 'chromium' }),
|
|
36
|
+
// playwrightLauncher({ product: 'firefox' }),
|
|
37
|
+
// playwrightLauncher({ product: 'webkit' }),
|
|
38
|
+
// ],
|
|
39
|
+
|
|
40
|
+
// See documentation for all available options
|
|
41
|
+
});
|
package/.editorconfig
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[*]
|
|
9
|
-
|
|
10
|
-
# Change these settings to your own preference
|
|
11
|
-
indent_style = space
|
|
12
|
-
indent_size = 2
|
|
13
|
-
|
|
14
|
-
# We recommend you to keep these unchanged
|
|
15
|
-
end_of_line = lf
|
|
16
|
-
charset = utf-8
|
|
17
|
-
trim_trailing_whitespace = true
|
|
18
|
-
insert_final_newline = true
|
|
19
|
-
|
|
20
|
-
[*.md]
|
|
21
|
-
trim_trailing_whitespace = false
|
|
22
|
-
|
|
23
|
-
[*.json]
|
|
24
|
-
indent_size = 2
|
|
25
|
-
|
|
26
|
-
[*.{html,js,md}]
|
|
27
|
-
block_comment_start = /**
|
|
28
|
-
block_comment = *
|
|
29
|
-
block_comment_end = */
|
package/demo/index.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<style>
|
|
6
|
-
body {
|
|
7
|
-
background: #fafafa;
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="demo"></div>
|
|
13
|
-
|
|
14
|
-
<script type="module">
|
|
15
|
-
import { html, render } from 'lit';
|
|
16
|
-
import '../dist/src/ix-textbox.js';
|
|
17
|
-
|
|
18
|
-
const header = 'Hello owc World!';
|
|
19
|
-
render(
|
|
20
|
-
html`
|
|
21
|
-
<ix-textbox .header=${header}>
|
|
22
|
-
some light-dom
|
|
23
|
-
</ix-textbox>
|
|
24
|
-
`,
|
|
25
|
-
document.querySelector('#demo')
|
|
26
|
-
);
|
|
27
|
-
</script>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit';
|
|
2
|
-
import '../src/ix-textbox.js';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: string;
|
|
6
|
-
argTypes: {
|
|
7
|
-
header: {
|
|
8
|
-
control: string;
|
|
9
|
-
};
|
|
10
|
-
counter: {
|
|
11
|
-
control: string;
|
|
12
|
-
};
|
|
13
|
-
textColor: {
|
|
14
|
-
control: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
19
|
-
interface Story<T> {
|
|
20
|
-
(args: T): TemplateResult;
|
|
21
|
-
args?: Partial<T>;
|
|
22
|
-
argTypes?: Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
interface ArgTypes {
|
|
25
|
-
header?: string;
|
|
26
|
-
counter?: number;
|
|
27
|
-
textColor?: string;
|
|
28
|
-
slot?: TemplateResult;
|
|
29
|
-
}
|
|
30
|
-
export declare const Regular: Story<ArgTypes>;
|
|
31
|
-
export declare const CustomHeader: Story<ArgTypes>;
|
|
32
|
-
export declare const CustomCounter: Story<ArgTypes>;
|
|
33
|
-
export declare const SlottedContent: Story<ArgTypes>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../src/ix-textbox.js';
|
|
3
|
-
export default {
|
|
4
|
-
title: 'IxTextbox',
|
|
5
|
-
component: 'ix-textbox',
|
|
6
|
-
argTypes: {
|
|
7
|
-
header: { control: 'text' },
|
|
8
|
-
counter: { control: 'number' },
|
|
9
|
-
textColor: { control: 'color' },
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const Template = ({ header = 'Hello world', counter = 5, textColor, slot, }) => html `
|
|
13
|
-
<ix-textbox
|
|
14
|
-
style="--ix-textbox-text-color: ${textColor || 'black'}"
|
|
15
|
-
.header=${header}
|
|
16
|
-
.counter=${counter}
|
|
17
|
-
>
|
|
18
|
-
${slot}
|
|
19
|
-
</ix-textbox>
|
|
20
|
-
`;
|
|
21
|
-
export const Regular = Template.bind({});
|
|
22
|
-
export const CustomHeader = Template.bind({});
|
|
23
|
-
CustomHeader.args = {
|
|
24
|
-
header: 'My header',
|
|
25
|
-
};
|
|
26
|
-
export const CustomCounter = Template.bind({});
|
|
27
|
-
CustomCounter.args = {
|
|
28
|
-
counter: 123456,
|
|
29
|
-
};
|
|
30
|
-
export const SlottedContent = Template.bind({});
|
|
31
|
-
SlottedContent.args = {
|
|
32
|
-
slot: html `<p>Slotted content</p>`,
|
|
33
|
-
};
|
|
34
|
-
SlottedContent.argTypes = {
|
|
35
|
-
slot: { table: { disable: true } },
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,sBAAsB,CAAC;AAE9B,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAChC;CACF,CAAC;AAeF,MAAM,QAAQ,GAAoB,CAAC,EACjC,MAAM,GAAG,aAAa,EACtB,OAAO,GAAG,CAAC,EACX,SAAS,EACT,IAAI,GACK,EAAE,EAAE,CAAC,IAAI,CAAA;;sCAEkB,SAAS,IAAI,OAAO;cAC5C,MAAM;eACL,OAAO;;MAEhB,IAAI;;CAET,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9C,YAAY,CAAC,IAAI,GAAG;IAClB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/C,aAAa,CAAC,IAAI,GAAG;IACnB,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChD,cAAc,CAAC,IAAI,GAAG;IACpB,IAAI,EAAE,IAAI,CAAA,wBAAwB;CACnC,CAAC;AACF,cAAc,CAAC,QAAQ,GAAG;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport '../src/ix-textbox.js';\n\nexport default {\n title: 'IxTextbox',\n component: 'ix-textbox',\n argTypes: {\n header: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' },\n },\n};\n\ninterface Story<T> {\n (args: T): TemplateResult;\n args?: Partial<T>;\n argTypes?: Record<string, unknown>;\n}\n\ninterface ArgTypes {\n header?: string;\n counter?: number;\n textColor?: string;\n slot?: TemplateResult;\n}\n\nconst Template: Story<ArgTypes> = ({\n header = 'Hello world',\n counter = 5,\n textColor,\n slot,\n}: ArgTypes) => html`\n <ix-textbox\n style=\"--ix-textbox-text-color: ${textColor || 'black'}\"\n .header=${header}\n .counter=${counter}\n >\n ${slot}\n </ix-textbox>\n`;\n\nexport const Regular = Template.bind({});\n\nexport const CustomHeader = Template.bind({});\nCustomHeader.args = {\n header: 'My header',\n};\n\nexport const CustomCounter = Template.bind({});\nCustomCounter.args = {\n counter: 123456,\n};\n\nexport const SlottedContent = Template.bind({});\nSlottedContent.args = {\n slot: html`<p>Slotted content</p>`,\n};\nSlottedContent.argTypes = {\n slot: { table: { disable: true } },\n};\n"]}
|