@spectrum-web-components/search 0.10.5 → 0.10.6
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 +7 -7
- package/sp-search.d.ts +6 -0
- package/sp-search.js +14 -0
- package/sp-search.js.map +1 -0
- package/src/Search.d.ts +25 -0
- package/src/Search.js +121 -0
- package/src/Search.js.map +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +13 -0
- package/src/index.js.map +1 -0
- package/src/search.css.d.ts +2 -0
- package/src/search.css.js +62 -0
- package/src/search.css.js.map +1 -0
- package/src/spectrum-search.css.d.ts +2 -0
- package/src/spectrum-search.css.js +62 -0
- package/src/spectrum-search.css.js.map +1 -0
- package/stories/search.stories.js +26 -0
- package/stories/search.stories.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/search",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"lit-html"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.5.
|
|
48
|
-
"@spectrum-web-components/button": "^0.17.
|
|
49
|
-
"@spectrum-web-components/icon": "^0.11.
|
|
50
|
-
"@spectrum-web-components/icons-workflow": "^0.8.
|
|
51
|
-
"@spectrum-web-components/textfield": "^0.11.
|
|
47
|
+
"@spectrum-web-components/base": "^0.5.4",
|
|
48
|
+
"@spectrum-web-components/button": "^0.17.1",
|
|
49
|
+
"@spectrum-web-components/icon": "^0.11.5",
|
|
50
|
+
"@spectrum-web-components/icons-workflow": "^0.8.5",
|
|
51
|
+
"@spectrum-web-components/textfield": "^0.11.3",
|
|
52
52
|
"tslib": "^2.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"sideEffects": [
|
|
60
60
|
"./sp-*.js"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "caf12727e7f91dcf961e1fadacc727eea9ece27b"
|
|
63
63
|
}
|
package/sp-search.d.ts
ADDED
package/sp-search.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { Search } from './src/Search.js';
|
|
13
|
+
customElements.define('sp-search', Search);
|
|
14
|
+
//# sourceMappingURL=sp-search.js.map
|
package/sp-search.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sp-search.js","sourceRoot":"","sources":["sp-search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC","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*/\nimport { Search } from './src/Search.js';\n\ncustomElements.define('sp-search', Search);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-search': Search;\n }\n}\n"]}
|
package/src/Search.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import { Textfield } from '@spectrum-web-components/textfield';
|
|
3
|
+
import '@spectrum-web-components/button/sp-clear-button.js';
|
|
4
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-magnify.js';
|
|
5
|
+
/**
|
|
6
|
+
* @element sp-search
|
|
7
|
+
* @slot help-text - default or non-negative help text to associate to your form element
|
|
8
|
+
* @slot negative-help-text - negative help text to associate to your form element when `invalid`
|
|
9
|
+
*
|
|
10
|
+
* @fires submit - The search form has been submitted.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Search extends Textfield {
|
|
13
|
+
static get styles(): CSSResultArray;
|
|
14
|
+
action: string;
|
|
15
|
+
label: string;
|
|
16
|
+
method?: 'GET' | 'POST' | 'dialog';
|
|
17
|
+
placeholder: string;
|
|
18
|
+
form: HTMLFormElement;
|
|
19
|
+
private handleSubmit;
|
|
20
|
+
private handleKeydown;
|
|
21
|
+
reset(): Promise<void>;
|
|
22
|
+
protected renderField(): TemplateResult;
|
|
23
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
24
|
+
updated(changedProperties: PropertyValues): void;
|
|
25
|
+
}
|
package/src/Search.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { __decorate } from "tslib";
|
|
13
|
+
import { html, } from '@spectrum-web-components/base';
|
|
14
|
+
import { property, query, } from '@spectrum-web-components/base/src/decorators.js';
|
|
15
|
+
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
16
|
+
import { Textfield } from '@spectrum-web-components/textfield';
|
|
17
|
+
import '@spectrum-web-components/button/sp-clear-button.js';
|
|
18
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-magnify.js';
|
|
19
|
+
import searchStyles from './search.css.js';
|
|
20
|
+
const stopPropagation = (event) => event.stopPropagation();
|
|
21
|
+
/**
|
|
22
|
+
* @element sp-search
|
|
23
|
+
* @slot help-text - default or non-negative help text to associate to your form element
|
|
24
|
+
* @slot negative-help-text - negative help text to associate to your form element when `invalid`
|
|
25
|
+
*
|
|
26
|
+
* @fires submit - The search form has been submitted.
|
|
27
|
+
*/
|
|
28
|
+
export class Search extends Textfield {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.action = '';
|
|
32
|
+
this.label = 'Search';
|
|
33
|
+
this.placeholder = 'Search';
|
|
34
|
+
}
|
|
35
|
+
static get styles() {
|
|
36
|
+
return [...super.styles, searchStyles];
|
|
37
|
+
}
|
|
38
|
+
handleSubmit(event) {
|
|
39
|
+
const applyDefault = this.dispatchEvent(new Event('submit', {
|
|
40
|
+
cancelable: true,
|
|
41
|
+
bubbles: true,
|
|
42
|
+
}));
|
|
43
|
+
if (!applyDefault) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleKeydown(event) {
|
|
48
|
+
const { code } = event;
|
|
49
|
+
if (!this.value || code !== 'Escape') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.reset();
|
|
53
|
+
}
|
|
54
|
+
async reset() {
|
|
55
|
+
this.value = '';
|
|
56
|
+
await this.updateComplete;
|
|
57
|
+
this.focusElement.dispatchEvent(new InputEvent('input', {
|
|
58
|
+
bubbles: true,
|
|
59
|
+
composed: true,
|
|
60
|
+
}));
|
|
61
|
+
// The native `change` event on an `input` element is not composed,
|
|
62
|
+
// so this synthetic replication of a `change` event must not be
|
|
63
|
+
// either as the `Textfield` baseclass should only need to handle
|
|
64
|
+
// the native variant of this interaction.
|
|
65
|
+
this.focusElement.dispatchEvent(new InputEvent('change', {
|
|
66
|
+
bubbles: true,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
renderField() {
|
|
70
|
+
return html `
|
|
71
|
+
<form
|
|
72
|
+
action=${this.action}
|
|
73
|
+
id="form"
|
|
74
|
+
method=${ifDefined(this.method)}
|
|
75
|
+
@submit=${this.handleSubmit}
|
|
76
|
+
@reset=${this.reset}
|
|
77
|
+
@keydown=${this.handleKeydown}
|
|
78
|
+
>
|
|
79
|
+
<sp-icon-magnify
|
|
80
|
+
class="icon magnifier icon-workflow"
|
|
81
|
+
></sp-icon-magnify>
|
|
82
|
+
${super.renderField()}
|
|
83
|
+
${this.value
|
|
84
|
+
? html `
|
|
85
|
+
<sp-clear-button
|
|
86
|
+
id="button"
|
|
87
|
+
label="Reset"
|
|
88
|
+
tabindex="-1"
|
|
89
|
+
type="reset"
|
|
90
|
+
@keydown=${stopPropagation}
|
|
91
|
+
></sp-clear-button>
|
|
92
|
+
`
|
|
93
|
+
: html ``}
|
|
94
|
+
</form>
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
firstUpdated(changedProperties) {
|
|
98
|
+
super.firstUpdated(changedProperties);
|
|
99
|
+
this.inputElement.setAttribute('type', 'search');
|
|
100
|
+
}
|
|
101
|
+
updated(changedProperties) {
|
|
102
|
+
super.updated(changedProperties);
|
|
103
|
+
this.multiline = false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
__decorate([
|
|
107
|
+
property()
|
|
108
|
+
], Search.prototype, "action", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], Search.prototype, "label", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property()
|
|
114
|
+
], Search.prototype, "method", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property()
|
|
117
|
+
], Search.prototype, "placeholder", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
query('#form')
|
|
120
|
+
], Search.prototype, "form", void 0);
|
|
121
|
+
//# sourceMappingURL=Search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Search.js","sourceRoot":"","sources":["Search.ts"],"names":[],"mappings":"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","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 {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport { Textfield } from '@spectrum-web-components/textfield';\nimport '@spectrum-web-components/button/sp-clear-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-magnify.js';\n\nimport searchStyles from './search.css.js';\n\nconst stopPropagation = (event: Event): void => event.stopPropagation();\n\n/**\n * @element sp-search\n * @slot help-text - default or non-negative help text to associate to your form element\n * @slot negative-help-text - negative help text to associate to your form element when `invalid`\n *\n * @fires submit - The search form has been submitted.\n */\nexport class Search extends Textfield {\n public static get styles(): CSSResultArray {\n return [...super.styles, searchStyles];\n }\n\n @property()\n public action = '';\n\n @property()\n public label = 'Search';\n\n @property()\n public method?: 'GET' | 'POST' | 'dialog';\n\n @property()\n public placeholder = 'Search';\n\n @query('#form')\n public form!: HTMLFormElement;\n\n private handleSubmit(event: Event): void {\n const applyDefault = this.dispatchEvent(\n new Event('submit', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n event.preventDefault();\n }\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n if (!this.value || code !== 'Escape') {\n return;\n }\n this.reset();\n }\n\n public async reset(): Promise<void> {\n this.value = '';\n await this.updateComplete;\n this.focusElement.dispatchEvent(\n new InputEvent('input', {\n bubbles: true,\n composed: true,\n })\n );\n // The native `change` event on an `input` element is not composed,\n // so this synthetic replication of a `change` event must not be\n // either as the `Textfield` baseclass should only need to handle\n // the native variant of this interaction.\n this.focusElement.dispatchEvent(\n new InputEvent('change', {\n bubbles: true,\n })\n );\n }\n\n protected renderField(): TemplateResult {\n return html`\n <form\n action=${this.action}\n id=\"form\"\n method=${ifDefined(this.method)}\n @submit=${this.handleSubmit}\n @reset=${this.reset}\n @keydown=${this.handleKeydown}\n >\n <sp-icon-magnify\n class=\"icon magnifier icon-workflow\"\n ></sp-icon-magnify>\n ${super.renderField()}\n ${this.value\n ? html`\n <sp-clear-button\n id=\"button\"\n label=\"Reset\"\n tabindex=\"-1\"\n type=\"reset\"\n @keydown=${stopPropagation}\n ></sp-clear-button>\n `\n : html``}\n </form>\n `;\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n this.inputElement.setAttribute('type', 'search');\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n this.multiline = false;\n }\n}\n"]}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Search.js';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export * from './Search.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,cAAc,aAAa,CAAC","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*/\nexport * from './Search.js';\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { css } from '@spectrum-web-components/base';
|
|
13
|
+
const styles = css `
|
|
14
|
+
:host{--spectrum-search-quiet-button-offset:calc(var(
|
|
15
|
+
--spectrum-actionbutton-m-texticon-min-width,
|
|
16
|
+
var(--spectrum-global-dimension-size-400)
|
|
17
|
+
)/2 - var(--spectrum-alias-ui-icon-cross-size-100)/2)}#textfield{display:inline-block;position:relative}:host([dir=ltr]) #button{right:0}:host([dir=rtl]) #button{left:0}#button{position:absolute;top:0}#input{-webkit-appearance:none;border-radius:var(
|
|
18
|
+
--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)
|
|
19
|
+
);outline-offset:-2px}#input::-webkit-search-cancel-button,#input::-webkit-search-decoration{-webkit-appearance:none}#textfield:after{border-radius:var(
|
|
20
|
+
--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)
|
|
21
|
+
)}:host([dir=ltr]:not([quiet])) #textfield .icon{left:var(
|
|
22
|
+
--spectrum-alias-search-padding-left-m
|
|
23
|
+
)}:host([dir=rtl]:not([quiet])) #textfield .icon{right:var(
|
|
24
|
+
--spectrum-alias-search-padding-left-m
|
|
25
|
+
)}:host([dir=ltr]:not([quiet])) #textfield #input{padding-left:calc(var(--spectrum-alias-search-padding-left-m) + var(
|
|
26
|
+
--spectrum-alias-workflow-icon-size-m,
|
|
27
|
+
var(--spectrum-global-dimension-size-225)
|
|
28
|
+
) + var(
|
|
29
|
+
--spectrum-textfield-m-texticon-icon-gap,
|
|
30
|
+
var(--spectrum-global-dimension-size-100)
|
|
31
|
+
) - var(
|
|
32
|
+
--spectrum-textfield-m-texticon-border-size,
|
|
33
|
+
var(--spectrum-alias-input-border-size)
|
|
34
|
+
))}:host([dir=rtl]:not([quiet])) #textfield #input{padding-right:calc(var(--spectrum-alias-search-padding-left-m) + var(
|
|
35
|
+
--spectrum-alias-workflow-icon-size-m,
|
|
36
|
+
var(--spectrum-global-dimension-size-225)
|
|
37
|
+
) + var(
|
|
38
|
+
--spectrum-textfield-m-texticon-icon-gap,
|
|
39
|
+
var(--spectrum-global-dimension-size-100)
|
|
40
|
+
) - var(
|
|
41
|
+
--spectrum-textfield-m-texticon-border-size,
|
|
42
|
+
var(--spectrum-alias-input-border-size)
|
|
43
|
+
))}:host([quiet]) #button{transform:translateX(var(--spectrum-search-quiet-button-offset))}:host([quiet]) #input{border-radius:var(
|
|
44
|
+
--spectrum-alias-search-border-radius-quiet,0
|
|
45
|
+
)}:host([quiet]) #textfield:after{border-radius:var(
|
|
46
|
+
--spectrum-alias-search-border-radius-quiet,0
|
|
47
|
+
)}.icon{color:var(
|
|
48
|
+
--spectrum-textfield-m-texticon-icon-color,var(--spectrum-alias-component-icon-color-default)
|
|
49
|
+
)}#input:hover~.icon{color:var(
|
|
50
|
+
--spectrum-search-m-icon-color-hover,var(--spectrum-alias-component-icon-color-hover)
|
|
51
|
+
)}#input:active~.icon{color:var(
|
|
52
|
+
--spectrum-search-m-icon-color-down,var(--spectrum-alias-component-icon-color-down)
|
|
53
|
+
)}#input.focus-visible~.icon{color:var(
|
|
54
|
+
--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)
|
|
55
|
+
)}#input:focus-visible~.icon{color:var(
|
|
56
|
+
--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)
|
|
57
|
+
)}#input:disabled~.icon{color:var(
|
|
58
|
+
--spectrum-textfield-m-texticon-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)
|
|
59
|
+
)}input::-webkit-search-cancel-button{display:none}
|
|
60
|
+
`;
|
|
61
|
+
export default styles;
|
|
62
|
+
//# sourceMappingURL=search.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.css.js","sourceRoot":"","sources":["search.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-search-quiet-button-offset:calc(var(\n--spectrum-actionbutton-m-texticon-min-width,\nvar(--spectrum-global-dimension-size-400)\n)/2 - var(--spectrum-alias-ui-icon-cross-size-100)/2)}#textfield{display:inline-block;position:relative}:host([dir=ltr]) #button{right:0}:host([dir=rtl]) #button{left:0}#button{position:absolute;top:0}#input{-webkit-appearance:none;border-radius:var(\n--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)\n);outline-offset:-2px}#input::-webkit-search-cancel-button,#input::-webkit-search-decoration{-webkit-appearance:none}#textfield:after{border-radius:var(\n--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)\n)}:host([dir=ltr]:not([quiet])) #textfield .icon{left:var(\n--spectrum-alias-search-padding-left-m\n)}:host([dir=rtl]:not([quiet])) #textfield .icon{right:var(\n--spectrum-alias-search-padding-left-m\n)}:host([dir=ltr]:not([quiet])) #textfield #input{padding-left:calc(var(--spectrum-alias-search-padding-left-m) + var(\n--spectrum-alias-workflow-icon-size-m,\nvar(--spectrum-global-dimension-size-225)\n) + var(\n--spectrum-textfield-m-texticon-icon-gap,\nvar(--spectrum-global-dimension-size-100)\n) - var(\n--spectrum-textfield-m-texticon-border-size,\nvar(--spectrum-alias-input-border-size)\n))}:host([dir=rtl]:not([quiet])) #textfield #input{padding-right:calc(var(--spectrum-alias-search-padding-left-m) + var(\n--spectrum-alias-workflow-icon-size-m,\nvar(--spectrum-global-dimension-size-225)\n) + var(\n--spectrum-textfield-m-texticon-icon-gap,\nvar(--spectrum-global-dimension-size-100)\n) - var(\n--spectrum-textfield-m-texticon-border-size,\nvar(--spectrum-alias-input-border-size)\n))}:host([quiet]) #button{transform:translateX(var(--spectrum-search-quiet-button-offset))}:host([quiet]) #input{border-radius:var(\n--spectrum-alias-search-border-radius-quiet,0\n)}:host([quiet]) #textfield:after{border-radius:var(\n--spectrum-alias-search-border-radius-quiet,0\n)}.icon{color:var(\n--spectrum-textfield-m-texticon-icon-color,var(--spectrum-alias-component-icon-color-default)\n)}#input:hover~.icon{color:var(\n--spectrum-search-m-icon-color-hover,var(--spectrum-alias-component-icon-color-hover)\n)}#input:active~.icon{color:var(\n--spectrum-search-m-icon-color-down,var(--spectrum-alias-component-icon-color-down)\n)}#input.focus-visible~.icon{color:var(\n--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)\n)}#input:focus-visible~.icon{color:var(\n--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)\n)}#input:disabled~.icon{color:var(\n--spectrum-textfield-m-texticon-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}input::-webkit-search-cancel-button{display:none}\n`;\nexport default styles;"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { css } from '@spectrum-web-components/base';
|
|
13
|
+
const styles = css `
|
|
14
|
+
:host{--spectrum-search-quiet-button-offset:calc(var(
|
|
15
|
+
--spectrum-actionbutton-m-texticon-min-width,
|
|
16
|
+
var(--spectrum-global-dimension-size-400)
|
|
17
|
+
)/2 - var(--spectrum-alias-ui-icon-cross-size-100)/2)}#textfield{display:inline-block;position:relative}:host([dir=ltr]) #button{right:0}:host([dir=rtl]) #button{left:0}#button{position:absolute;top:0}#input{-webkit-appearance:none;border-radius:var(
|
|
18
|
+
--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)
|
|
19
|
+
);outline-offset:-2px}#input::-webkit-search-cancel-button,#input::-webkit-search-decoration{-webkit-appearance:none}#textfield:after{border-radius:var(
|
|
20
|
+
--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)
|
|
21
|
+
)}:host([dir=ltr]:not([quiet])) #textfield .icon{left:var(
|
|
22
|
+
--spectrum-alias-search-padding-left-m
|
|
23
|
+
)}:host([dir=rtl]:not([quiet])) #textfield .icon{right:var(
|
|
24
|
+
--spectrum-alias-search-padding-left-m
|
|
25
|
+
)}:host([dir=ltr]:not([quiet])) #textfield #input{padding-left:calc(var(--spectrum-alias-search-padding-left-m) + var(
|
|
26
|
+
--spectrum-alias-workflow-icon-size-m,
|
|
27
|
+
var(--spectrum-global-dimension-size-225)
|
|
28
|
+
) + var(
|
|
29
|
+
--spectrum-textfield-m-texticon-icon-gap,
|
|
30
|
+
var(--spectrum-global-dimension-size-100)
|
|
31
|
+
) - var(
|
|
32
|
+
--spectrum-textfield-m-texticon-border-size,
|
|
33
|
+
var(--spectrum-alias-input-border-size)
|
|
34
|
+
))}:host([dir=rtl]:not([quiet])) #textfield #input{padding-right:calc(var(--spectrum-alias-search-padding-left-m) + var(
|
|
35
|
+
--spectrum-alias-workflow-icon-size-m,
|
|
36
|
+
var(--spectrum-global-dimension-size-225)
|
|
37
|
+
) + var(
|
|
38
|
+
--spectrum-textfield-m-texticon-icon-gap,
|
|
39
|
+
var(--spectrum-global-dimension-size-100)
|
|
40
|
+
) - var(
|
|
41
|
+
--spectrum-textfield-m-texticon-border-size,
|
|
42
|
+
var(--spectrum-alias-input-border-size)
|
|
43
|
+
))}:host([quiet]) #button{transform:translateX(var(--spectrum-search-quiet-button-offset))}:host([quiet]) #input{border-radius:var(
|
|
44
|
+
--spectrum-alias-search-border-radius-quiet,0
|
|
45
|
+
)}:host([quiet]) #textfield:after{border-radius:var(
|
|
46
|
+
--spectrum-alias-search-border-radius-quiet,0
|
|
47
|
+
)}.icon{color:var(
|
|
48
|
+
--spectrum-textfield-m-texticon-icon-color,var(--spectrum-alias-component-icon-color-default)
|
|
49
|
+
)}#input:hover~.icon{color:var(
|
|
50
|
+
--spectrum-search-m-icon-color-hover,var(--spectrum-alias-component-icon-color-hover)
|
|
51
|
+
)}#input:active~.icon{color:var(
|
|
52
|
+
--spectrum-search-m-icon-color-down,var(--spectrum-alias-component-icon-color-down)
|
|
53
|
+
)}#input.focus-visible~.icon{color:var(
|
|
54
|
+
--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)
|
|
55
|
+
)}#input:focus-visible~.icon{color:var(
|
|
56
|
+
--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)
|
|
57
|
+
)}#input:disabled~.icon{color:var(
|
|
58
|
+
--spectrum-textfield-m-texticon-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)
|
|
59
|
+
)}
|
|
60
|
+
`;
|
|
61
|
+
export default styles;
|
|
62
|
+
//# sourceMappingURL=spectrum-search.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spectrum-search.css.js","sourceRoot":"","sources":["spectrum-search.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-search-quiet-button-offset:calc(var(\n--spectrum-actionbutton-m-texticon-min-width,\nvar(--spectrum-global-dimension-size-400)\n)/2 - var(--spectrum-alias-ui-icon-cross-size-100)/2)}#textfield{display:inline-block;position:relative}:host([dir=ltr]) #button{right:0}:host([dir=rtl]) #button{left:0}#button{position:absolute;top:0}#input{-webkit-appearance:none;border-radius:var(\n--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)\n);outline-offset:-2px}#input::-webkit-search-cancel-button,#input::-webkit-search-decoration{-webkit-appearance:none}#textfield:after{border-radius:var(\n--spectrum-alias-search-border-radius,var(--spectrum-global-dimension-size-50)\n)}:host([dir=ltr]:not([quiet])) #textfield .icon{left:var(\n--spectrum-alias-search-padding-left-m\n)}:host([dir=rtl]:not([quiet])) #textfield .icon{right:var(\n--spectrum-alias-search-padding-left-m\n)}:host([dir=ltr]:not([quiet])) #textfield #input{padding-left:calc(var(--spectrum-alias-search-padding-left-m) + var(\n--spectrum-alias-workflow-icon-size-m,\nvar(--spectrum-global-dimension-size-225)\n) + var(\n--spectrum-textfield-m-texticon-icon-gap,\nvar(--spectrum-global-dimension-size-100)\n) - var(\n--spectrum-textfield-m-texticon-border-size,\nvar(--spectrum-alias-input-border-size)\n))}:host([dir=rtl]:not([quiet])) #textfield #input{padding-right:calc(var(--spectrum-alias-search-padding-left-m) + var(\n--spectrum-alias-workflow-icon-size-m,\nvar(--spectrum-global-dimension-size-225)\n) + var(\n--spectrum-textfield-m-texticon-icon-gap,\nvar(--spectrum-global-dimension-size-100)\n) - var(\n--spectrum-textfield-m-texticon-border-size,\nvar(--spectrum-alias-input-border-size)\n))}:host([quiet]) #button{transform:translateX(var(--spectrum-search-quiet-button-offset))}:host([quiet]) #input{border-radius:var(\n--spectrum-alias-search-border-radius-quiet,0\n)}:host([quiet]) #textfield:after{border-radius:var(\n--spectrum-alias-search-border-radius-quiet,0\n)}.icon{color:var(\n--spectrum-textfield-m-texticon-icon-color,var(--spectrum-alias-component-icon-color-default)\n)}#input:hover~.icon{color:var(\n--spectrum-search-m-icon-color-hover,var(--spectrum-alias-component-icon-color-hover)\n)}#input:active~.icon{color:var(\n--spectrum-search-m-icon-color-down,var(--spectrum-alias-component-icon-color-down)\n)}#input.focus-visible~.icon{color:var(\n--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)\n)}#input:focus-visible~.icon{color:var(\n--spectrum-search-m-icon-color-key-focus,var(--spectrum-alias-component-icon-color-key-focus)\n)}#input:disabled~.icon{color:var(\n--spectrum-textfield-m-texticon-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}\n`;\nexport default styles;"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2018 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import '../sp-search.js';
|
|
13
|
+
import { html } from '@spectrum-web-components/base';
|
|
14
|
+
export default {
|
|
15
|
+
component: 'sp-search',
|
|
16
|
+
title: 'Search',
|
|
17
|
+
};
|
|
18
|
+
export const Default = () => html `
|
|
19
|
+
<sp-search></sp-search>
|
|
20
|
+
<sp-search disabled></sp-search>
|
|
21
|
+
`;
|
|
22
|
+
export const Quiet = () => html `
|
|
23
|
+
<sp-search quiet></sp-search>
|
|
24
|
+
<sp-search quiet disabled></sp-search>
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=search.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.stories.js","sourceRoot":"","sources":["search.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AAErE,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,QAAQ;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,GAAmB,EAAE,CAAC,IAAI,CAAA;;;CAGhD,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAmB,EAAE,CAAC,IAAI,CAAA;;;CAG9C,CAAC","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 '../sp-search.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nexport default {\n component: 'sp-search',\n title: 'Search',\n};\n\nexport const Default = (): TemplateResult => html`\n <sp-search></sp-search>\n <sp-search disabled></sp-search>\n`;\n\nexport const Quiet = (): TemplateResult => html`\n <sp-search quiet></sp-search>\n <sp-search quiet disabled></sp-search>\n`;\n"]}
|