@spectrum-web-components/textfield 1.0.2 → 1.0.3

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.
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import "@spectrum-web-components/textfield/sp-textfield.js";
4
+ import "@spectrum-web-components/field-label/sp-field-label.js";
5
+ import "@spectrum-web-components/help-text/sp-help-text.js";
6
+ export default {
7
+ component: "sp-textfield",
8
+ title: "Textfield"
9
+ };
10
+ export const Default = () => {
11
+ return html`
12
+ <sp-textfield placeholder="Enter your name"></sp-textfield>
13
+ <sp-textfield placeholder="Enter your name" disabled></sp-textfield>
14
+ <sp-textfield
15
+ placeholder="Enter your name"
16
+ pattern="[\\w\\s]*"
17
+ required
18
+ value="A valid input"
19
+ ></sp-textfield>
20
+ <sp-textfield
21
+ placeholder="Enter your name"
22
+ pattern="[\\w\\s]*"
23
+ required
24
+ value="A valid input"
25
+ disabled
26
+ ></sp-textfield>
27
+ <sp-textfield
28
+ placeholder="Enter your name"
29
+ pattern="[\\d]*"
30
+ value="Not a valid input"
31
+ ></sp-textfield>
32
+ <sp-textfield
33
+ placeholder="Enter your name"
34
+ pattern="^[\\d]$"
35
+ required
36
+ value="Not a valid input"
37
+ disabled
38
+ ></sp-textfield>
39
+ `;
40
+ };
41
+ export const growsOnly = () => {
42
+ return html`
43
+ <sp-field-label for="grows-only">
44
+ This Textfield has the "grows" attribute without the "multiline"
45
+ attribute
46
+ </sp-field-label>
47
+ <sp-textfield
48
+ grows
49
+ id="grows-only"
50
+ placeholder="Does not grow or display incorrectly"
51
+ ></sp-textfield>
52
+ `;
53
+ };
54
+ export const quiet = () => {
55
+ return html`
56
+ <sp-field-label for="name">Enter your name</sp-field-label>
57
+ <sp-textfield
58
+ autofocus
59
+ id="name"
60
+ placeholder="This Text Field doesn't make much noise"
61
+ quiet
62
+ ></sp-textfield>
63
+ `;
64
+ };
65
+ export const notRequiredWithPattern = () => {
66
+ return html`
67
+ <sp-textfield
68
+ placeholder="Enter z, x, c, or v"
69
+ pattern="[zxcv]+"
70
+ ></sp-textfield>
71
+ `;
72
+ };
73
+ export const allowedKeys = () => {
74
+ return html`
75
+ <sp-textfield
76
+ placeholder="Enter your name"
77
+ allowed-keys="a-z"
78
+ ></sp-textfield>
79
+ `;
80
+ };
81
+ export const withNameAttribute = () => {
82
+ return html`
83
+ <sp-textfield
84
+ name="name"
85
+ placeholder="Enter your name"
86
+ allowed-keys="a-z"
87
+ ></sp-textfield>
88
+ `;
89
+ };
90
+ export const readonly = () => html`
91
+ <sp-textfield
92
+ label="Enter your life story"
93
+ value="A readonly textfield"
94
+ readonly
95
+ placeholder="Enter your life story"
96
+ ></sp-textfield>
97
+ `;
98
+ export const types = () => html`
99
+ <sp-textfield label="Default" placeholder="default (text)"></sp-textfield>
100
+ <sp-textfield label="Text" type="text" placeholder="text"></sp-textfield>
101
+ <sp-textfield label="URL" type="url" placeholder="url"></sp-textfield>
102
+ <sp-textfield label="Tel" type="tel" placeholder="tel"></sp-textfield>
103
+ <sp-textfield
104
+ label="E-Mail"
105
+ type="email"
106
+ placeholder="email"
107
+ ></sp-textfield>
108
+ <sp-textfield
109
+ label="Password"
110
+ type="password"
111
+ placeholder="password"
112
+ ></sp-textfield>
113
+ `;
114
+ export const empty = () => html`
115
+ <sp-field-label for="empty">
116
+ This textfield hasn't been used yet
117
+ </sp-field-label>
118
+ <sp-textfield id="empty" placeholder="You can type here" autofocus>
119
+ <sp-help-text slot="help-text">
120
+ Even empty Textfield display correctly while waiting for content.
121
+ </sp-help-text>
122
+ </sp-textfield>
123
+ `;
124
+ export const sized = () => html`
125
+ <sp-field-label for="sized">
126
+ This textfield hasn't been used yet
127
+ </sp-field-label>
128
+ <sp-textfield
129
+ id="sized"
130
+ placeholder="You can type here"
131
+ autofocus
132
+ style="width: 400px"
133
+ >
134
+ <sp-help-text slot="help-text">
135
+ Even empty Textfield display correctly while waiting for content.
136
+ </sp-help-text>
137
+ </sp-textfield>
138
+ `;
139
+ //# sourceMappingURL=textfield.stories.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textfield.stories.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2018 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/textfield/sp-textfield.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport '@spectrum-web-components/help-text/sp-help-text.js';\n\nexport default {\n component: 'sp-textfield',\n title: 'Textfield',\n};\n\nexport const Default = (): TemplateResult => {\n return html`\n <sp-textfield placeholder=\"Enter your name\"></sp-textfield>\n <sp-textfield placeholder=\"Enter your name\" disabled></sp-textfield>\n <sp-textfield\n placeholder=\"Enter your name\"\n pattern=\"[\\\\w\\\\s]*\"\n required\n value=\"A valid input\"\n ></sp-textfield>\n <sp-textfield\n placeholder=\"Enter your name\"\n pattern=\"[\\\\w\\\\s]*\"\n required\n value=\"A valid input\"\n disabled\n ></sp-textfield>\n <sp-textfield\n placeholder=\"Enter your name\"\n pattern=\"[\\\\d]*\"\n value=\"Not a valid input\"\n ></sp-textfield>\n <sp-textfield\n placeholder=\"Enter your name\"\n pattern=\"^[\\\\d]$\"\n required\n value=\"Not a valid input\"\n disabled\n ></sp-textfield>\n `;\n};\n\nexport const growsOnly = (): TemplateResult => {\n return html`\n <sp-field-label for=\"grows-only\">\n This Textfield has the \"grows\" attribute without the \"multiline\"\n attribute\n </sp-field-label>\n <sp-textfield\n grows\n id=\"grows-only\"\n placeholder=\"Does not grow or display incorrectly\"\n ></sp-textfield>\n `;\n};\n\nexport const quiet = (): TemplateResult => {\n return html`\n <sp-field-label for=\"name\">Enter your name</sp-field-label>\n <sp-textfield\n autofocus\n id=\"name\"\n placeholder=\"This Text Field doesn't make much noise\"\n quiet\n ></sp-textfield>\n `;\n};\n\nexport const notRequiredWithPattern = (): TemplateResult => {\n return html`\n <sp-textfield\n placeholder=\"Enter z, x, c, or v\"\n pattern=\"[zxcv]+\"\n ></sp-textfield>\n `;\n};\n\nexport const allowedKeys = (): TemplateResult => {\n return html`\n <sp-textfield\n placeholder=\"Enter your name\"\n allowed-keys=\"a-z\"\n ></sp-textfield>\n `;\n};\n\nexport const withNameAttribute = (): TemplateResult => {\n return html`\n <sp-textfield\n name=\"name\"\n placeholder=\"Enter your name\"\n allowed-keys=\"a-z\"\n ></sp-textfield>\n `;\n};\n\nexport const readonly = (): TemplateResult => html`\n <sp-textfield\n label=\"Enter your life story\"\n value=\"A readonly textfield\"\n readonly\n placeholder=\"Enter your life story\"\n ></sp-textfield>\n`;\n\nexport const types = (): TemplateResult => html`\n <sp-textfield label=\"Default\" placeholder=\"default (text)\"></sp-textfield>\n <sp-textfield label=\"Text\" type=\"text\" placeholder=\"text\"></sp-textfield>\n <sp-textfield label=\"URL\" type=\"url\" placeholder=\"url\"></sp-textfield>\n <sp-textfield label=\"Tel\" type=\"tel\" placeholder=\"tel\"></sp-textfield>\n <sp-textfield\n label=\"E-Mail\"\n type=\"email\"\n placeholder=\"email\"\n ></sp-textfield>\n <sp-textfield\n label=\"Password\"\n type=\"password\"\n placeholder=\"password\"\n ></sp-textfield>\n`;\n\nexport const empty = (): TemplateResult => html`\n <sp-field-label for=\"empty\">\n This textfield hasn't been used yet\n </sp-field-label>\n <sp-textfield id=\"empty\" placeholder=\"You can type here\" autofocus>\n <sp-help-text slot=\"help-text\">\n Even empty Textfield display correctly while waiting for content.\n </sp-help-text>\n </sp-textfield>\n`;\n\nexport const sized = (): TemplateResult => html`\n <sp-field-label for=\"sized\">\n This textfield hasn't been used yet\n </sp-field-label>\n <sp-textfield\n id=\"sized\"\n placeholder=\"You can type here\"\n autofocus\n style=\"width: 400px\"\n >\n <sp-help-text slot=\"help-text\">\n Even empty Textfield display correctly while waiting for content.\n </sp-help-text>\n </sp-textfield>\n`;\n"],
5
+ "mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,OAAO;AAEP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEO,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BX;AAEO,aAAM,YAAY,MAAsB;AAC3C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWX;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASX;AAEO,aAAM,yBAAyB,MAAsB;AACxD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAMX;AAEO,aAAM,cAAc,MAAsB;AAC7C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAMX;AAEO,aAAM,oBAAoB,MAAsB;AACnD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOX;AAEO,aAAM,WAAW,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASvC,aAAM,QAAQ,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBpC,aAAM,QAAQ,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWpC,aAAM,QAAQ,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ import "@spectrum-web-components/textfield/sp-textfield.js";
3
+ import { html } from "lit";
4
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
5
+ measureFixtureCreation(html`
6
+ <sp-textfield placeholder="Enter your name"></sp-textfield>
7
+ `);
8
+ //# sourceMappingURL=test-basic.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["test-basic.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/textfield/sp-textfield.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-textfield placeholder=\"Enter your name\"></sp-textfield>\n`);\n"],
5
+ "mappings": ";AAYA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,CAEtB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import * as stories from "../stories/textarea-sizes.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("TextareaSizesStories", stories);
5
+ //# sourceMappingURL=textarea-sizes.test-vrt.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textarea-sizes.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/textarea-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TextareaSizesStories', stories as unknown as TestsType);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,wBAAwB,OAA+B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import * as stories from "../stories/textarea.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("TextareaStories", stories);
5
+ //# sourceMappingURL=textarea.test-vrt.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textarea.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/textarea.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TextareaStories', stories as unknown as TestsType);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,mBAAmB,OAA+B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ import { html } from "@open-wc/testing";
3
+ import "@spectrum-web-components/textfield/sp-textfield.js";
4
+ import { testForMemoryLeaks } from "../../../test/testing-helpers.js";
5
+ testForMemoryLeaks(html`
6
+ <sp-textfield></sp-textfield>
7
+ `);
8
+ //# sourceMappingURL=textfield-memory.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textfield-memory.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html } from '@open-wc/testing';\nimport '@spectrum-web-components/textfield/sp-textfield.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(html`\n <sp-textfield></sp-textfield>\n`);\n"],
5
+ "mappings": ";AAWA,SAAS,YAAY;AACrB,OAAO;AACP,SAAS,0BAA0B;AAEnC,mBAAmB;AAAA;AAAA,CAElB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import * as stories from "../stories/textfield-sizes.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("TextfieldSizesStories", stories);
5
+ //# sourceMappingURL=textfield-sizes.test-vrt.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textfield-sizes.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/textfield-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TextfieldSizesStories', stories as unknown as TestsType);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,yBAAyB,OAA+B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import * as stories from "../stories/textfield.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("TextfieldStories", stories);
5
+ //# sourceMappingURL=textfield.test-vrt.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["textfield.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/textfield.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TextfieldStories', stories as unknown as TestsType);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,oBAAoB,OAA+B;",
6
+ "names": []
7
+ }